Qx v0.6
Qt Extensions Library
Loading...
Searching...
No Matches
Qx::Lopmap< Key, T, Compare >::const_iterator Class Reference

The Lopmap::const_iterator class provides an STL-style const iterator for Lopmap. More...

#include <qx/core/qx-lopmap.h>

Public Types

using iterator_category = typename StorageItr::iterator_category
 

Public Member Functions

 const_iterator ()
 
const Key & key () const
 
const T & operator* () const
 
const_iteratoroperator++ ()
 
const_iterator operator++ (int)
 
const_iteratoroperator-- ()
 
const_iterator operator-- (int)
 
const T * operator-> () const
 
bool operator== (const const_iterator &other) const =default
 
const T & value () const
 

Friends

class Lopmap< Key, T, Compare >
 

Detailed Description

template<typename Key, typename T, typename Compare>
class Qx::Lopmap< Key, T, Compare >::const_iterator

Lopmap<Key, T, Compare>::const_iterator allows you to iterate over a Lopmap.

The default Lopmap::const_iterator constructor creates an uninitialized iterator. You must initialize it using a Lopmap function like Lopmap::cbegin(), Lopmap::cend(), or Lopmap::constFind() before you can start iterating.

Lopmap stores its items ordered according to Compare.

Multiple iterators can be used on the same map. If you add items to the map, existing iterators will remain valid. If you remove items from the map, iterators that point to the removed items will become dangling iterators.

Inserting relationships into the lopmap or calling methods such as Lopmap::reserve() or Lopmap::squeeze() can invalidate all iterators pointing into the lopmap. Iterators are guaranteed to stay valid only as long as the Lopmap doesn't have to grow/shrink its internal table. Using any iterator after a rehashing operation has occurred will lead to undefined behavior

Member Typedef Documentation

◆ iterator_category

template<typename Key , typename T , typename Compare >
Qx::Lopmap< Key, T, Compare >::const_iterator::iterator_category = typename StorageItr::iterator_category

A synonym for std::bidirectional_iterator_tag indicating this iterator is a bidirectional iterator.

Constructor & Destructor Documentation

◆ const_iterator()

template<typename Key , typename T , typename Compare >
Qx::Lopmap< Key, T, Compare >::const_iterator::const_iterator ( )
inline

Constructs an uninitialized iterator.

Functions like key(), value(), and operator++() must not be called on an uninitialized iterator. Use operator=() to assign a value to it before using it.

See also
Lopmap::constBegin() and Lopmap::constEnd().

Member Function Documentation

◆ key()

template<typename Key , typename T , typename Compare >
const Key & Qx::Lopmap< Key, T, Compare >::const_iterator::key ( ) const
inline

Returns the current item's key.

See also
value() and operator*().

◆ operator*()

template<typename Key , typename T , typename Compare >
const T & Qx::Lopmap< Key, T, Compare >::const_iterator::operator* ( ) const
inline

Returns the current item's value.

See also
key().

◆ operator++() [1/2]

template<typename Key , typename T , typename Compare >
const_iterator Qx::Lopmap< Key, T, Compare >::const_iterator::operator++ ( )
inline

The prefix ++ operator (++i) advances the iterator to the next item in the lopmap and returns an iterator to the new item relationship.

Calling this function on Lopmap::constEnd() leads to undefined results.

See also
operator--().

◆ operator++() [2/2]

template<typename Key , typename T , typename Compare >
const_iterator Qx::Lopmap< Key, T, Compare >::const_iterator::operator++ ( int )
inline

The postfix ++ operator (i++) advances the iterator to the next item in the lopmap and returns an iterator to the previously current item.

Calling this function on Lopmap::constEnd() leads to undefined results.

◆ operator--() [1/2]

template<typename Key , typename T , typename Compare >
const_iterator Qx::Lopmap< Key, T, Compare >::const_iterator::operator-- ( )
inline

The prefix -- operator (--i) makes the preceding item current and returns an iterator to the new current item.

Calling this function on Lopmap::constBegin() leads to undefined results.

See also
operator++().

◆ operator--() [2/2]

template<typename Key , typename T , typename Compare >
const_iterator Qx::Lopmap< Key, T, Compare >::const_iterator::operator-- ( int )
inline

The postfix -- operator (--i) makes the preceding item current and returns an iterator to the previously current item.

Calling this function on Lopmap::constEnd() leads to undefined results.

◆ operator->()

template<typename Key , typename T , typename Compare >
const T * Qx::Lopmap< Key, T, Compare >::const_iterator::operator-> ( ) const
inline

Returns a pointer to the current item's value.

See also
value().

◆ operator==()

template<typename Key , typename T , typename Compare >
bool Qx::Lopmap< Key, T, Compare >::const_iterator::operator== ( const const_iterator & other) const
default

Returns true if other points to the same item as this iterator; otherwise, returns false.

◆ value()

template<typename Key , typename T , typename Compare >
const T & Qx::Lopmap< Key, T, Compare >::const_iterator::value ( ) const
inline

Returns the current item's value.

See also
key().

The documentation for this class was generated from the following files: