From: Vadim Zeitlin Date: Fri, 6 Apr 2007 22:56:06 +0000 (+0000) Subject: added operator-(const wxChar *, const wxCStrData&) to allow compilation of the code... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/cc5bd48eff6f3a12b6066179d1b00d6404c9d921?ds=inline added operator-(const wxChar *, const wxCStrData&) to allow compilation of the code doing "p - s.c_str()" where p is a pointer into the string s git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/string.h b/include/wx/string.h index 72900dcfb1..208f343912 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -2347,6 +2347,22 @@ inline wxUniChar wxCStrData::operator[](size_t n) const return m_str->at(m_offset + n); } +// ---------------------------------------------------------------------------- +// more wxCStrData operators +// ---------------------------------------------------------------------------- + +// we need to define those to allow "size_t pos = p - s.c_str()" where p is +// some pointer into the string +inline size_t operator-(const char *p, const wxCStrData& cs) +{ + return p - cs.AsChar(); +} + +inline size_t operator-(const wchar_t *p, const wxCStrData& cs) +{ + return p - cs.AsWChar(); +} + // ---------------------------------------------------------------------------- // implementation of wx[W]CharBuffer inline methods using wxCStrData // ----------------------------------------------------------------------------