Add wxVector::shrink_to_fit() for C++11 compatibility

Also use this for wxArray::Shrink() implementation as it's more
efficient than the old swap-based implementation which requires an extra
memory allocation instead of really shrinking the existing one.
This commit is contained in:
Vadim Zeitlin
2017-11-19 22:09:37 +01:00
parent 9e714fdb5e
commit 53443b5370
3 changed files with 42 additions and 0 deletions

View File

@@ -262,6 +262,18 @@ public:
void resize(size_type n, const value_type& v);
//@}
/**
Free unused memory allocated by the vector.
Reduces the memory used by the vector to the bare minimum required to
hold its current number of elements, possibly 0.
After calling this method, capacity() returns the same as size().
@since 3.1.1
*/
void shrink_to_fit();
/**
Returns the size of the vector.
*/