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:
@@ -375,6 +375,12 @@ public:
|
||||
return m_capacity;
|
||||
}
|
||||
|
||||
void shrink_to_fit()
|
||||
{
|
||||
m_values = Ops::Realloc(m_values, m_size, m_size);
|
||||
m_capacity = m_size;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return size() == 0;
|
||||
|
Reference in New Issue
Block a user