diff --git a/include/wx/string.h b/include/wx/string.h index 6667f8fae8..2ae0085719 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -429,9 +429,9 @@ public: const_iterator end() const { return m_pchData + length(); } // first valid index position - iterator begin() { CopyBeforeWrite(); return m_pchData; } + iterator begin(); // position one after the last valid one - iterator end() { CopyBeforeWrite(); return m_pchData + length(); } + iterator end(); // insert another string wxStringBase& insert(size_t nPos, const wxStringBase& str) diff --git a/src/common/string.cpp b/src/common/string.cpp index 9b1de655cd..70473982fd 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -407,6 +407,20 @@ bool wxStringBase::Alloc(size_t nLen) //else: we've already got enough return TRUE; } + +wxStringBase::iterator wxStringBase::begin() +{ + if (length() > 0) + CopyBeforeWrite(); + return m_pchData; +} + +wxStringBase::iterator wxStringBase::end() +{ + if (length() > 0) + CopyBeforeWrite(); + return m_pchData + length(); +} wxStringBase::iterator wxStringBase::erase(iterator it) {