Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Public Types | Public Member Functions
ext::map_move_iterator< Iterator, KeyType, ValueType > Class Template Reference

Adaptor iterator to allow values to be moved from a map. Internaly calls reinterpret cast to dereference result of underlying map iterator. More...

#include <iterator.hpp>

Public Types

typedef Iterator iterator_type
 The underlying iterator type. More...
 
using iterator_category = typename std::iterator_traits< Iterator >::iterator_category
 iterator_category is inherited. More...
 
typedef std::pair< KeyType, ValueType > value_type
 The value type is essentially the value_type of adapted iterator but constructed here to avoid consts. More...
 
typedef value_type && reference
 Reference type is rvalue reference to the value type. More...
 
typedef value_typepointer
 The pointer type is a pointer to the value_type. More...
 
using difference_type = std::ptrdiff_t
 Difference_type is standard pointer difference type. More...
 

Public Member Functions

 map_move_iterator (Iterator it)
 Constructor of the set move iterator adaptor. More...
 
iterator_type base () const
 Getter of the underlying set iterator. More...
 
pointer operator-> () const
 Arrow operator using the reinterpret cast. More...
 
reference operator* () const
 Dereference operator using the reinterpret cast. More...
 
map_move_iteratoroperator++ ()
 Increment operator. More...
 
map_move_iteratoroperator-- ()
 Decrement operator. More...
 
map_move_iterator operator++ (int)
 Increment operator. More...
 
map_move_iterator operator-- (int)
 Decrement operator. More...
 
bool operator== (const map_move_iterator< Iterator, KeyType, ValueType > &other) const
 Comparison of iterators for equality. More...
 

Detailed Description

template<class Iterator, class KeyType, class ValueType>
class ext::map_move_iterator< Iterator, KeyType, ValueType >

Adaptor iterator to allow values to be moved from a map. Internaly calls reinterpret cast to dereference result of underlying map iterator.

Template Parameters
Iteratorthe adapted iterator
KeyTypethe key type of adapted map's iterator
ValueTypethe value type of adapted map's iterator

Member Typedef Documentation

◆ difference_type

template<class Iterator , class KeyType , class ValueType >
using ext::map_move_iterator< Iterator, KeyType, ValueType >::difference_type = std::ptrdiff_t

Difference_type is standard pointer difference type.

◆ iterator_category

template<class Iterator , class KeyType , class ValueType >
using ext::map_move_iterator< Iterator, KeyType, ValueType >::iterator_category = typename std::iterator_traits < Iterator >::iterator_category

iterator_category is inherited.

◆ iterator_type

template<class Iterator , class KeyType , class ValueType >
typedef Iterator ext::map_move_iterator< Iterator, KeyType, ValueType >::iterator_type

The underlying iterator type.

◆ pointer

template<class Iterator , class KeyType , class ValueType >
typedef value_type* ext::map_move_iterator< Iterator, KeyType, ValueType >::pointer

The pointer type is a pointer to the value_type.

◆ reference

template<class Iterator , class KeyType , class ValueType >
typedef value_type&& ext::map_move_iterator< Iterator, KeyType, ValueType >::reference

Reference type is rvalue reference to the value type.

◆ value_type

template<class Iterator , class KeyType , class ValueType >
typedef std::pair< KeyType, ValueType > ext::map_move_iterator< Iterator, KeyType, ValueType >::value_type

The value type is essentially the value_type of adapted iterator but constructed here to avoid consts.

Constructor & Destructor Documentation

◆ map_move_iterator()

template<class Iterator , class KeyType , class ValueType >
ext::map_move_iterator< Iterator, KeyType, ValueType >::map_move_iterator ( Iterator  it)
inlineexplicit

Constructor of the set move iterator adaptor.

Parameters
itthe underlying set iterator

Member Function Documentation

◆ base()

template<class Iterator , class KeyType , class ValueType >
iterator_type ext::map_move_iterator< Iterator, KeyType, ValueType >::base ( ) const
inline

Getter of the underlying set iterator.

Returns
the underlying iterator

◆ operator*()

template<class Iterator , class KeyType , class ValueType >
reference ext::map_move_iterator< Iterator, KeyType, ValueType >::operator* ( ) const
inline

Dereference operator using the reinterpret cast.

Returns
rvalue reference to const casted value pointed to by underlying set iterator
Here is the caller graph for this function:

◆ operator++() [1/2]

template<class Iterator , class KeyType , class ValueType >
map_move_iterator & ext::map_move_iterator< Iterator, KeyType, ValueType >::operator++ ( )
inline

Increment operator.

Increments the underlying operator.

Returns
the modified iterator

◆ operator++() [2/2]

template<class Iterator , class KeyType , class ValueType >
map_move_iterator ext::map_move_iterator< Iterator, KeyType, ValueType >::operator++ ( int  )
inline

Increment operator.

Increments the underlying operator.

Returns
the original iterator

◆ operator--() [1/2]

template<class Iterator , class KeyType , class ValueType >
map_move_iterator & ext::map_move_iterator< Iterator, KeyType, ValueType >::operator-- ( )
inline

Decrement operator.

Decrements the underlying operator.

Returns
the modified iterator

◆ operator--() [2/2]

template<class Iterator , class KeyType , class ValueType >
map_move_iterator ext::map_move_iterator< Iterator, KeyType, ValueType >::operator-- ( int  )
inline

Decrement operator.

Decrements the underlying operator.

Returns
the original iterator

◆ operator->()

template<class Iterator , class KeyType , class ValueType >
pointer ext::map_move_iterator< Iterator, KeyType, ValueType >::operator-> ( ) const
inline

Arrow operator using the reinterpret cast.

Returns
const casted pointer to the value pointed to by underlying set iterator
Here is the call graph for this function:

◆ operator==()

template<class Iterator , class KeyType , class ValueType >
bool ext::map_move_iterator< Iterator, KeyType, ValueType >::operator== ( const map_move_iterator< Iterator, KeyType, ValueType > &  other) const
inline

Comparison of iterators for equality.

Parameters
otherthe other iterator
Returns
true if the two iterators underlying iterators are equal

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