Qx v0.6
Qt Extensions Library
|
The Bimap::const_iterator class provides an STL-style const iterator for Bimap. More...
#include <qx/core/qx-bimap.h>
Public Member Functions | |
const_iterator () | |
const Left & | left () const |
std::pair< const Left &, const Right & > | operator* () const |
const_iterator & | operator++ () |
const_iterator | operator++ (int) |
bool | operator== (const const_iterator &other) const =default |
const Right & | right () const |
Friends | |
class | Bimap< Left, Right > |
Bimap<Left, Right>::const_iterator allows you to iterate over a Bimap.
The default Bimap::const_iterator constructor creates an uninitialized iterator. You must initialize it using a Bimap function like Bimap::cbegin(), Bimap::cend(), or Bimap::constFind() before you can start iterating.
Bimap stores its relationships in an arbitrary order.
Multiple iterators can be used on the same bimap. However, be aware that any modification performed directly on the Bimap (inserting and removing items) can cause the iterators to become invalid.
Inserting relationships into the bimap or calling methods such as Bimap::reserve() or Bimap::squeeze() can invalidate all iterators pointing into the bimap. Iterators are guaranteed to stay valid only as long as the Bimap doesn't have to grow/shrink its internal table. Using any iterator after a rehashing operation has occurred will lead to undefined behavior.
You can however safely use iterators to remove entries from the bimap using the Bimap::erase() method. This function can safely be called while iterating, and won't affect the order of items in the bimap.
|
inline |
Constructs an uninitialized iterator.
Functions like left(), right(), and operator++() must not be called on an uninitialized iterator. Use operator=() to assign a value to it before using it.
|
inline |
Returns the current relationship's Left value.
|
inline |
Returns the current relationship.
|
inline |
The prefix ++
operator (++i) advances the iterator to the next relationship in the bimap and returns an iterator to the new current relationship.
Calling this function on Bimap::constEnd() leads to undefined results.
|
inline |
The postfix ++
operator (i++) advances the iterator to the next relationship in the bimap and returns an iterator to the previously current relationship.
Calling this function on Bimap::constEnd() leads to undefined results.
|
default |
Returns true
if other points to the same relationship as this iterator; otherwise, returns false
.
|
inline |
Returns the current relationship's Right value.