From 013984337a9d9289aa8bcdd36426baa912c56b82 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 18 Mar 2005 15:27:14 +0000 Subject: [PATCH] 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 --- include/wx/string.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/include/wx/string.h b/include/wx/string.h index 5e58e21121..3b8db06455 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -724,11 +724,25 @@ public: /* 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 - version of operatorp[] at all as indexed access to const string - is provided by implicit conversion to "const wxChar *" below. + ambiguity when using str[0]. Also note that for a conforming compiler we + don't need const version of operatorp[] at all as indexed access to + 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() wxChar& operator[](int n) { return wxStringBase::at(n); } -- 2.45.2