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

Adaptor iterator to additionally call second dereference on the iterator dereference result. More...

#include <iterator.hpp>

Public Types

using pointer = typename std::iterator_traits< Iterator >::value_type
 The pointer type is the value of adapted iterator. More...
 
using value_type = typename std::conditional< std::is_const< typename std::remove_reference< typename std::iterator_traits< Iterator >::reference >::type >::value, typename std::add_const< typename std::remove_pointer< pointer >::type >::type, typename std::remove_pointer< pointer >::type >::type
 The value type is the value of adapted iterator without pointer. More...
 
using difference_type = std::ptrdiff_t
 Difference_type is standard pointer difference type. More...
 
using reference = value_type &
 Reference type is reference to the value type. More...
 
using iterator_category = typename std::iterator_traits< Iterator >::iterator_category
 iterator_category is inherited. More...
 

Public Member Functions

 dereferencing_iterator (Iterator base)
 Constructor of the dereferencing iterator adaptor. More...
 
template<class Iter >
 dereferencing_iterator (const dereferencing_iterator< Iter > &iter)
 
reference operator* () const
 Dereference operator doing extra dereference. More...
 
pointer operator-> () const
 Arrow operator doing extra dereference. More...
 
dereferencing_iterator< Iterator > & operator++ ()
 Increment operator. More...
 
dereferencing_iterator< Iterator > operator++ (int)
 Increment operator. More...
 
dereferencing_iterator< Iterator > & operator-- ()
 Decrement operator. More...
 
dereferencing_iterator< Iterator > operator-- (int)
 Decrement operator. More...
 
dereferencing_iterator< Iterator > & operator+= (int distance)
 Shifs the iterator by distance. More...
 
dereferencing_iterator< Iterator > operator+ (int distance) const
 Creates a new iterator and shifs it by distance. More...
 
dereferencing_iterator< Iterator > & operator-= (int distance)
 Shifs the iterator back by distance. More...
 
dereferencing_iterator< Iterator > operator- (int distance) const
 Creates a new iterator and shifs it back by distance. More...
 
reference operator[] (int index) const
 Array subscript operator. More...
 
difference_type operator- (const dereferencing_iterator< Iterator > &other) const
 Distance of two iterators computation operator. More...
 
bool operator== (const dereferencing_iterator< Iterator > &other) const
 Comparison of iterators for equality. More...
 
auto operator<=> (const dereferencing_iterator< Iterator > &other) const
 Less than comparison of iterators. More...
 
Iterator base () const
 The underlying iterator getter. More...
 

Detailed Description

template<class Iterator>
class ext::dereferencing_iterator< Iterator >

Adaptor iterator to additionally call second dereference on the iterator dereference result.

Template Parameters
Iteratorthe adapted iterator

Member Typedef Documentation

◆ difference_type

template<class Iterator >
using ext::dereferencing_iterator< Iterator >::difference_type = std::ptrdiff_t

Difference_type is standard pointer difference type.

◆ iterator_category

template<class Iterator >
using ext::dereferencing_iterator< Iterator >::iterator_category = typename std::iterator_traits < Iterator >::iterator_category

iterator_category is inherited.

◆ pointer

template<class Iterator >
using ext::dereferencing_iterator< Iterator >::pointer = typename std::iterator_traits < Iterator >::value_type

The pointer type is the value of adapted iterator.

◆ reference

template<class Iterator >
using ext::dereferencing_iterator< Iterator >::reference = value_type &

Reference type is reference to the value type.

◆ value_type

template<class Iterator >
using ext::dereferencing_iterator< Iterator >::value_type = typename std::conditional < std::is_const < typename std::remove_reference < typename std::iterator_traits < Iterator >::reference >::type >::value, typename std::add_const < typename std::remove_pointer < pointer >::type >::type, typename std::remove_pointer < pointer >::type >::type

The value type is the value of adapted iterator without pointer.

Constructor & Destructor Documentation

◆ dereferencing_iterator() [1/2]

template<class Iterator >
ext::dereferencing_iterator< Iterator >::dereferencing_iterator ( Iterator  base)
inlineexplicit

Constructor of the dereferencing iterator adaptor.

Parameters
basethe underlying iterator

◆ dereferencing_iterator() [2/2]

template<class Iterator >
template<class Iter >
ext::dereferencing_iterator< Iterator >::dereferencing_iterator ( const dereferencing_iterator< Iter > &  iter)
inline

Cast constructor from dereferencing iterator adapting compatible iterator.

Template Parameters
Iterthe underlying iterator type of dereference iterator
Parameters
iterthe casted dereferencing iterator

Member Function Documentation

◆ base()

template<class Iterator >
Iterator ext::dereferencing_iterator< Iterator >::base ( ) const
inline

The underlying iterator getter.

Returns
the underlying iterator
Here is the caller graph for this function:

◆ operator*()

template<class Iterator >
reference ext::dereferencing_iterator< Iterator >::operator* ( ) const
inline

Dereference operator doing extra dereference.

Returns
the value pointed to by result of dereference of the underlying iterator

◆ operator+()

template<class Iterator >
dereferencing_iterator< Iterator > ext::dereferencing_iterator< Iterator >::operator+ ( int  distance) const
inline

Creates a new iterator and shifs it by distance.

Parameters
distancethe distance to shift by
Returns
the new iterator

◆ operator++() [1/2]

template<class Iterator >
dereferencing_iterator< Iterator > & ext::dereferencing_iterator< Iterator >::operator++ ( )
inline

Increment operator.

Increments the underlying operator.

Returns
the modified iterator

◆ operator++() [2/2]

template<class Iterator >
dereferencing_iterator< Iterator > ext::dereferencing_iterator< Iterator >::operator++ ( int  )
inline

Increment operator.

Increments the underlying operator.

Returns
the original iterator

◆ operator+=()

template<class Iterator >
dereferencing_iterator< Iterator > & ext::dereferencing_iterator< Iterator >::operator+= ( int  distance)
inline

Shifs the iterator by distance.

Parameters
distancethe distance to shift by
Returns
the modified iterator

◆ operator-() [1/2]

template<class Iterator >
difference_type ext::dereferencing_iterator< Iterator >::operator- ( const dereferencing_iterator< Iterator > &  other) const
inline

Distance of two iterators computation operator.

Parameters
otherthe other iterator
Returns
the distance between this and the other iterator

◆ operator-() [2/2]

template<class Iterator >
dereferencing_iterator< Iterator > ext::dereferencing_iterator< Iterator >::operator- ( int  distance) const
inline

Creates a new iterator and shifs it back by distance.

Parameters
distancethe distance to shift by
Returns
the new iterator

◆ operator--() [1/2]

template<class Iterator >
dereferencing_iterator< Iterator > & ext::dereferencing_iterator< Iterator >::operator-- ( )
inline

Decrement operator.

Decrements the underlying operator.

Returns
the modified iterator

◆ operator--() [2/2]

template<class Iterator >
dereferencing_iterator< Iterator > ext::dereferencing_iterator< Iterator >::operator-- ( int  )
inline

Decrement operator.

Decrements the underlying operator.

Returns
the original iterator

◆ operator-=()

template<class Iterator >
dereferencing_iterator< Iterator > & ext::dereferencing_iterator< Iterator >::operator-= ( int  distance)
inline

Shifs the iterator back by distance.

Parameters
distancethe distance to shift by
Returns
the modified iterator

◆ operator->()

template<class Iterator >
pointer ext::dereferencing_iterator< Iterator >::operator-> ( ) const
inline

Arrow operator doing extra dereference.

Returns
dereference of the underlying iterator

◆ operator<=>()

template<class Iterator >
auto ext::dereferencing_iterator< Iterator >::operator<=> ( const dereferencing_iterator< Iterator > &  other) const
inline

Less than comparison of iterators.

Parameters
otherthe other iterator
Returns
true if the underlying iterator of this is less than the underlying iterator of the other one

◆ operator==()

template<class Iterator >
bool ext::dereferencing_iterator< Iterator >::operator== ( const dereferencing_iterator< Iterator > &  other) const
inline

Comparison of iterators for equality.

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

◆ operator[]()

template<class Iterator >
reference ext::dereferencing_iterator< Iterator >::operator[] ( int  index) const
inline

Array subscript operator.

Additionaly dereferences the result of subscript of the underlying iterator.

Parameters
indexthe subscript index
Returns
the value pointed to by pointer at position given by index

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