Added assertion against broken usage of iterators,

...e.g. i != end which always return true when they are not from the
same unit map.
This commit is contained in:
Guillaume Melquiond 2010-08-14 08:00:47 +00:00
parent f9990e113a
commit 5ee8a00f1a

View file

@ -143,8 +143,10 @@ public:
bool valid() const
{ return map_ && map_->is_valid(i_); }
bool operator==(const iterator_base& rhs) const { return i_ == rhs.i_; }
bool operator!=(const iterator_base& rhs) const { return !operator==(rhs); }
bool operator==(const iterator_base &rhs) const
{ assert(map_ == rhs.map_); return i_ == rhs.i_; }
bool operator!=(const iterator_base &rhs) const
{ return !operator==(rhs); }
map_type* get_map() const { return map_; }