Implement wxString::Shrink() in terms of shrink_to_fit()

Now that we use C++11 there is no need to have our own Shrink()
implementation when we can just use the standard function.

Also mention that it's the same as shrink_to_fit() in Shrink()
documentation.

No real changes, just simplify the code and make it more efficient.
This commit is contained in:
Vadim Zeitlin 2023-03-28 16:50:11 +01:00
parent a1d289fe3e
commit 488950f724
3 changed files with 6 additions and 12 deletions

View file

@ -1368,7 +1368,7 @@ public:
size_type capacity() const { return m_impl.capacity(); }
void reserve(size_t sz) { m_impl.reserve(sz); }
void shrink_to_fit() { Shrink(); }
void shrink_to_fit() { m_impl.shrink_to_fit(); }
void resize(size_t nSize, wxUniChar ch = wxT('\0'))
{
@ -2241,8 +2241,7 @@ public:
// only works if the data of this string is not shared
bool Alloc(size_t nLen) { reserve(nLen); return capacity() >= nLen; }
// minimize the string's memory
// only works if the data of this string is not shared
bool Shrink();
bool Shrink() { shrink_to_fit(); return true; }
// wxWidgets version 1 compatibility functions