added wxCStrData::operator- for compatibility with expressions like 'c_str() + n - 2'
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
171d613212
commit
f4c90fdfaf
@ -220,6 +220,26 @@ public:
|
|||||||
wxCStrData operator+(size_t n) const
|
wxCStrData operator+(size_t n) const
|
||||||
{ return wxCStrData(m_str, m_offset + n, m_owned); }
|
{ return wxCStrData(m_str, m_offset + n, m_owned); }
|
||||||
|
|
||||||
|
// and these for "str.c_str() + n - 2":
|
||||||
|
wxCStrData operator-(int n) const
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( n <= (int)m_offset,
|
||||||
|
_T("attempt to construct address before the beginning of the string") );
|
||||||
|
return wxCStrData(m_str, m_offset - n, m_owned);
|
||||||
|
}
|
||||||
|
wxCStrData operator-(long n) const
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( n <= (int)m_offset,
|
||||||
|
_T("attempt to construct address before the beginning of the string") );
|
||||||
|
return wxCStrData(m_str, m_offset - n, m_owned);
|
||||||
|
}
|
||||||
|
wxCStrData operator-(size_t n) const
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( n <= (int)m_offset,
|
||||||
|
_T("attempt to construct address before the beginning of the string") );
|
||||||
|
return wxCStrData(m_str, m_offset - n, m_owned);
|
||||||
|
}
|
||||||
|
|
||||||
// this operator is needed to make expressions like "*c_str()" or
|
// this operator is needed to make expressions like "*c_str()" or
|
||||||
// "*(c_str() + 2)" work
|
// "*(c_str() + 2)" work
|
||||||
wxUniChar operator*() const;
|
wxUniChar operator*() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user