Commit 26c24d0b authored by Philipp A. Hartmann's avatar Philipp A. Hartmann

GenericMemberIterator: allow mixed-constness comparisons and differences

parent 618fe2f4
...@@ -118,9 +118,9 @@ public: ...@@ -118,9 +118,9 @@ public:
//! Iterator type itself //! Iterator type itself
typedef GenericMemberIterator Iterator; typedef GenericMemberIterator Iterator;
//! Constant iterator type //! Constant iterator type
typedef GenericMemberIterator<true,Encoding,Allocator> ConstType; typedef GenericMemberIterator<true,Encoding,Allocator> ConstIterator;
//! Non-constant iterator type //! Non-constant iterator type
typedef GenericMemberIterator<false,Encoding,Allocator> NonConstType; typedef GenericMemberIterator<false,Encoding,Allocator> NonConstIterator;
//! Pointer to (const) GenericMember //! Pointer to (const) GenericMember
typedef typename BaseType::pointer Pointer; typedef typename BaseType::pointer Pointer;
...@@ -151,7 +151,7 @@ public: ...@@ -151,7 +151,7 @@ public:
constructor effectively defines a regular copy-constructor. constructor effectively defines a regular copy-constructor.
Otherwise, the copy constructor is implicitly defined. Otherwise, the copy constructor is implicitly defined.
*/ */
GenericMemberIterator(const NonConstType & it) : ptr_( it.ptr_ ) {} GenericMemberIterator(const NonConstIterator & it) : ptr_(it.ptr_) {}
//! @name stepping //! @name stepping
//@{ //@{
...@@ -172,12 +172,12 @@ public: ...@@ -172,12 +172,12 @@ public:
//! @name relations //! @name relations
//@{ //@{
bool operator==(Iterator that) const { return ptr_ == that.ptr_; } bool operator==(ConstIterator that) const { return ptr_ == that.ptr_; }
bool operator!=(Iterator that) const { return ptr_ != that.ptr_; } bool operator!=(ConstIterator that) const { return ptr_ != that.ptr_; }
bool operator<=(Iterator that) const { return ptr_ <= that.ptr_; } bool operator<=(ConstIterator that) const { return ptr_ <= that.ptr_; }
bool operator>=(Iterator that) const { return ptr_ >= that.ptr_; } bool operator>=(ConstIterator that) const { return ptr_ >= that.ptr_; }
bool operator< (Iterator that) const { return ptr_ < that.ptr_; } bool operator< (ConstIterator that) const { return ptr_ < that.ptr_; }
bool operator> (Iterator that) const { return ptr_ > that.ptr_; } bool operator> (ConstIterator that) const { return ptr_ > that.ptr_; }
//@} //@}
//! @name dereference //! @name dereference
...@@ -188,7 +188,7 @@ public: ...@@ -188,7 +188,7 @@ public:
//@} //@}
//! Distance //! Distance
DifferenceType operator-(Iterator that) const { return ptr_-that.ptr_; } DifferenceType operator-(ConstIterator that) const { return ptr_-that.ptr_; }
private: private:
//! Internal constructor from plain pointer //! Internal constructor from plain pointer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment