|Reported by:||troelsk||Owned by:|
|Keywords:||wxArray wxArrayInt simple||Cc:|
The doc says that wxArray::SetCount() never shrinks the array. This is true, also for wxArray::resize(). But resize() you expect to behave as std::vector. And if building wx with wxUSE_STL, then resize() will happily shrink.
I suggest resize() being reimplemented to do as STL always, regardless of the wxUSE_STL flag, while preserving the SetCount() behaviour (in !wxUSE_STL mode at least)
std::vector<int> vector; vector.resize(5); vector.resize(2); wxASSERT(vector.size() == 2); wxArrayInt array; array.resize(5); array.resize(2); // doing nothing if !wxUSE_STL wxASSERT(array.size() == 2); // asserts if !wxUSE_STL
"If the array has already count or more items, nothing is done"
Change History (4)
comment:1 Changed 3 years ago by vadz
- Keywords simple added
- Priority changed from normal to low
- Status changed from new to confirmed