mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-24 16:27:42 +01:00
Handle self assignment for ObjArray.
This commit is contained in:
parent
be079edc92
commit
a2b8d1217f
@ -187,6 +187,7 @@ const XObjArray<TYPE> &XObjArray<TYPE>::operator =(const XObjArray<TYPE> &anObjA
|
||||
{
|
||||
xsize ui;
|
||||
|
||||
if ( this == &anObjArray ) return *this; // self assignement
|
||||
XObjArrayNC<TYPE>::Empty();
|
||||
this->CheckSize(anObjArray.length(), 0);
|
||||
for ( ui=0 ; ui<anObjArray.size() ; ui+=1 ) AddCopy(anObjArray.ElementAt(ui));
|
||||
|
@ -162,6 +162,19 @@ int XStringArray_tests()
|
||||
array.Add(L"3333");
|
||||
array.Add(L"4th_item");
|
||||
|
||||
XStringArray array2 = array;
|
||||
if ( array2 != array ) return 22;
|
||||
XStringArray* array2Ptr = &array2;
|
||||
*array2Ptr = array2;
|
||||
if ( array2 != array ) return 22;
|
||||
}
|
||||
{
|
||||
XStringArray array;
|
||||
array.Add(L"word1");
|
||||
array.Add(L"other2");
|
||||
array.Add(L"3333");
|
||||
array.Add(L"4th_item");
|
||||
|
||||
array.remove("WOrd1"_XS8);
|
||||
if ( !array.contains("word1"_XS8) ) return 22;
|
||||
array.remove("word1"_XS8);
|
||||
|
Loading…
Reference in New Issue
Block a user