From d6d6a61fed4c2cd7436e45334467f341fc822fdb Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 8 Jan 2011 17:16:29 +0000 Subject: [PATCH] proper const-ness for Item(), operator[](), and Last() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/arrstr.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/wx/arrstr.h b/include/wx/arrstr.h index f9e297dd33..bd37a1f000 100644 --- a/include/wx/arrstr.h +++ b/include/wx/arrstr.h @@ -173,23 +173,26 @@ public: // items access (range checking is done in debug version) // get item at position uiIndex - wxString& Item(size_t nIndex) const + wxString& Item(size_t nIndex) { wxASSERT_MSG( nIndex < m_nCount, wxT("wxArrayString: index out of bounds") ); return m_pItems[nIndex]; } + const wxString& Item(size_t nIndex) const { return const_cast(this)->Item(nIndex); } // same as Item() - wxString& operator[](size_t nIndex) const { return Item(nIndex); } + wxString& operator[](size_t nIndex) { return Item(nIndex); } + const wxString& operator[](size_t nIndex) const { return Item(nIndex); } // get last item - wxString& Last() const + wxString& Last() { wxASSERT_MSG( !IsEmpty(), wxT("wxArrayString: index out of bounds") ); return Item(GetCount() - 1); } + const wxString& Last() const { return const_cast(this)->Last(); } // item management -- 2.45.2