]> git.saurik.com Git - wxWidgets.git/commitdiff
string iterator's operator- should return difference_type, not size_t or unsigned
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 9 Apr 2007 08:18:33 +0000 (08:18 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 9 Apr 2007 08:18:33 +0000 (08:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45347 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/string.h
include/wx/stringimpl.h

index a39ea5636b4517937ad4d0fe80fdb7bdb50ece99..3cb68a0df4ae5b22893537a6d9f8f1cdf31e06dc 100644 (file)
@@ -638,7 +638,7 @@ public:
           iterator_name& operator-=(size_t n)                               \
             { m_cur = wxString::AddToIter(m_cur, -(int)n); return *this; }  \
                                                                             \
           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                     \
             { return wxString::DiffIters(m_cur, i.m_cur); }                 \
                                                                             \
           bool operator==(const iterator_name& i) const                     \
@@ -664,14 +664,14 @@ public:
           friend class WXDLLIMPEXP_BASE wxCStrData;                         \
                                                                             \
       private:                                                              \
           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,
 
   class const_iterator;
 
   class iterator
   {
       WX_STR_ITERATOR_IMPL(iterator, wxChar*, wxUniCharRef,
-                           wxUniCharRef::CreateForString(m_cur))
+                           wxUniCharRef::CreateForString(m_cur));
 
       friend class const_iterator;
   };
 
       friend class const_iterator;
   };
@@ -681,7 +681,7 @@ public:
       // 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,
       // 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) {}
 
   public:
       const_iterator(const iterator& i) : m_cur(i.m_cur) {}
index 04ff3e43a164e8667d27a672e89f010fd51ea85a..b680b52cf1a03ff9c317939107eb4c95b04d9fe0 100644 (file)
@@ -184,6 +184,7 @@ public:
         typedef wxStringCharType value_type;                                  \
         typedef ref_type reference;                                           \
         typedef ptr_type pointer;                                             \
         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(pointer ptr) : m_ptr(ptr) { }                           \
                                                                               \
@@ -222,7 +223,7 @@ public:
         iterator_name& operator-=(size_t n)                                   \
             { m_ptr -= n; return *this; }                                     \
                                                                               \
         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                         \
             { return m_ptr - i.m_ptr; }                                       \
                                                                               \
         bool operator==(const iterator_name& i) const                         \
@@ -271,6 +272,8 @@ public:
                                     const wxStringCharType*);
   };
 
                                     const wxStringCharType*);
   };
 
+  #undef WX_DEFINE_STRINGIMPL_ITERATOR
+
 
   // constructors and destructor
     // ctor for an empty string
 
   // constructors and destructor
     // ctor for an empty string