restored const operator[]s for the compilers which need them

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-03-18 15:27:14 +00:00
parent 9994e2daa0
commit 013984337a

View File

@@ -724,11 +724,25 @@ public:
/* /*
Note that we we must define all of the overloads below to avoid Note that we we must define all of the overloads below to avoid
ambiguity when using str[0]. Also note that we don't need const ambiguity when using str[0]. Also note that for a conforming compiler we
version of operatorp[] at all as indexed access to const string don't need const version of operatorp[] at all as indexed access to
is provided by implicit conversion to "const wxChar *" below. const string is provided by implicit conversion to "const wxChar *"
below and defining them would only result in ambiguities, but some other
compilers refuse to compile "str[0]" without them.
*/ */
#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__MWERKS__)
wxChar operator[](int n) const
{ return wxStringBase::at(n); }
wxChar operator[](size_type n) const
{ return wxStringBase::at(n); }
#ifndef wxSIZE_T_IS_UINT
wxChar operator[](unsigned int n) const
{ return wxStringBase::at(n); }
#endif // size_t != unsigned int
#endif // broken compiler
// operator versions of GetWriteableChar() // operator versions of GetWriteableChar()
wxChar& operator[](int n) wxChar& operator[](int n)
{ return wxStringBase::at(n); } { return wxStringBase::at(n); }