iterator_name& operator-=(size_t n) \
{ m_cur = wxString::AddToIter(m_cur, -(int)n); return *this; } \
\
- unsigned operator-(const iterator_name& i) const \
+ difference_type operator-(const iterator_name& i) const \
{ return wxString::DiffIters(m_cur, i.m_cur); } \
\
bool operator==(const iterator_name& i) const \
friend class WXDLLIMPEXP_BASE wxCStrData; \
\
private: \
- underlying_iterator m_cur;
+ underlying_iterator m_cur
class const_iterator;
class iterator
{
WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef,
- wxUniCharRef::CreateForString(m_cur))
+ wxUniCharRef::CreateForString(m_cur));
friend class const_iterator;
};
// NB: reference_type is intentionally value, not reference, the character
// may be encoded differently in wxString data:
WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar,
- wxUniChar(*m_cur))
+ wxUniChar(*m_cur));
public:
const_iterator(const iterator& i) : m_cur(i.m_cur) {}
typedef wxStringCharType value_type; \
typedef ref_type reference; \
typedef ptr_type pointer; \
+ typedef int difference_type; \
\
iterator_name(pointer ptr) : m_ptr(ptr) { } \
\
iterator_name& operator-=(size_t n) \
{ m_ptr -= n; return *this; } \
\
- size_t operator-(const iterator_name& i) const \
+ difference_type operator-(const iterator_name& i) const \
{ return m_ptr - i.m_ptr; } \
\
bool operator==(const iterator_name& i) const \
const wxStringCharType*);
};
+ #undef WX_DEFINE_STRINGIMPL_ITERATOR
+
// constructors and destructor
// ctor for an empty string