Also add wxObjArray::swap() for consistency with the other arrays
As with the previous commit, make this kind of arrays a bit more comfortable to use as long as we can't avoid using them completely.
This commit is contained in:
parent
a5f02170c4
commit
6d0b1369aa
2 changed files with 11 additions and 0 deletions
|
|
@ -436,6 +436,8 @@ public:
|
|||
|
||||
void Sort(CMPFUNC fCmp) { base::Sort(fCmp); }
|
||||
|
||||
void swap(wxBaseObjectArray& other) { base::swap(other); }
|
||||
|
||||
// Provide a way to iterate over the stored objects using range-based for.
|
||||
class ObjectIterator
|
||||
{
|
||||
|
|
|
|||
|
|
@ -616,6 +616,15 @@ TEST_CASE("wxObjArray", "[dynarray]")
|
|||
CHECK( bars.GetCount() == 3 );
|
||||
CHECK( Bar::GetNumber() == 4 );
|
||||
|
||||
ArrayBars tmp;
|
||||
bars.swap(tmp);
|
||||
CHECK( bars.size() == 0 );
|
||||
CHECK( Bar::GetNumber() == 4 );
|
||||
|
||||
bars.swap(tmp);
|
||||
CHECK( bars.size() == 3 );
|
||||
CHECK( Bar::GetNumber() == 4 );
|
||||
|
||||
bars.RemoveAt(1, bars.GetCount() - 1);
|
||||
|
||||
CHECK( bars.GetCount() == 1 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue