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
This commit is contained in:
@@ -173,23 +173,26 @@ public:
|
|||||||
|
|
||||||
// items access (range checking is done in debug version)
|
// items access (range checking is done in debug version)
|
||||||
// get item at position uiIndex
|
// get item at position uiIndex
|
||||||
wxString& Item(size_t nIndex) const
|
wxString& Item(size_t nIndex)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( nIndex < m_nCount,
|
wxASSERT_MSG( nIndex < m_nCount,
|
||||||
wxT("wxArrayString: index out of bounds") );
|
wxT("wxArrayString: index out of bounds") );
|
||||||
|
|
||||||
return m_pItems[nIndex];
|
return m_pItems[nIndex];
|
||||||
}
|
}
|
||||||
|
const wxString& Item(size_t nIndex) const { return const_cast<wxArrayString*>(this)->Item(nIndex); }
|
||||||
|
|
||||||
// same as Item()
|
// 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
|
// get last item
|
||||||
wxString& Last() const
|
wxString& Last()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !IsEmpty(),
|
wxASSERT_MSG( !IsEmpty(),
|
||||||
wxT("wxArrayString: index out of bounds") );
|
wxT("wxArrayString: index out of bounds") );
|
||||||
return Item(GetCount() - 1);
|
return Item(GetCount() - 1);
|
||||||
}
|
}
|
||||||
|
const wxString& Last() const { return const_cast<wxArrayString*>(this)->Last(); }
|
||||||
|
|
||||||
|
|
||||||
// item management
|
// item management
|
||||||
|
Reference in New Issue
Block a user