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
This commit is contained in:
Vadim Zeitlin
2007-04-06 22:56:06 +00:00
parent 0eabd3c635
commit cc5bd48eff

View File

@@ -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
// ----------------------------------------------------------------------------