implementation of the range insert for wxStringArray (patch 975003)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28133 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2004-07-01 11:47:52 +00:00
parent a24de76b33
commit 1f020bfb92

View File

@ -2221,6 +2221,30 @@ void wxArrayString::Insert(const wxString& str, size_t nIndex, size_t nInsert)
m_nCount += nInsert;
}
// range insert (STL 23.2.4.3)
void
wxArrayString::insert(iterator it, const_iterator first, const_iterator last)
{
const int idx = it - begin();
// grow it once
Grow(last - first);
// reset "it" since it can change inside Grow()
it = begin() + idx;
while ( first != last )
{
it = insert(it, *first);
// insert returns an iterator to the last element inserted but we need
// insert the next after this one, that is before the next one
++it;
++first;
}
}
// expand the array
void wxArrayString::SetCount(size_t count)
{