added wxArrayString::swap()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-09-11 13:35:32 +00:00
parent 1aac44b9da
commit 9127686895
3 changed files with 44 additions and 0 deletions

View File

@@ -301,6 +301,25 @@ public:
void reserve(size_type n) /* base::reserve*/;
void resize(size_type n, value_type v = value_type());
size_type size() const { return GetCount(); }
void swap(wxArrayString& other)
{
// not sure if we can rely on having std::swap() everywhere so do it
// manually
const size_t savedSize = m_nSize;
const size_t savedCount = m_nCount;
wxString * const savedItems = m_pItems;
const bool savedAutoSort = m_autoSort;
m_nSize = other.m_nSize;
m_nCount = other.m_nCount;
m_pItems = other.m_pItems;
m_autoSort = other.m_autoSort;
other.m_nSize = savedSize;
other.m_nCount = savedCount;
other.m_pItems = savedItems;
other.m_autoSort = savedAutoSort;
}
protected:
void Init(bool autoSort); // common part of all ctors