X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9d9ad67384e5dc658c4de46e49113c321489bf81..d11e8786ed13b72766eea18cb577cc00f9f08f41:/include/wx/string.h 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); }