Public Member Functions | Private Types | Private Attributes | List of all members
util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference > Class Template Reference

#include <MappedContainer.h>

Public Types

Traits
using value_type = std::remove_cv_t< typename Container_t::value_type >
 
using difference_type = typename Container_t::difference_type
 
using size_type = typename Container_t::size_type
 
using reference = Reference_t
 
using pointer = decltype(&std::declval< reference >())
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

 IteratorBase ()=default
 Constructor: an invalid iterator. More...
 
 IteratorBase (Container_t &cont, MappingIndex_t index)
 Constructor: iterator pointing to element index of cont. More...
 
 IteratorBase (Iterator_t const &)=default
 Copy constructor. More...
 
template<typename OC , typename OR >
 IteratorBase (IteratorBase< OC, OR > const &from)
 Copy constructor: from a different container type. More...
 
Iterator_toperator= (Iterator_t const &)=default
 Copy assignment. More...
 
template<typename OC , typename OR >
Iterator_toperator= (IteratorBase< OC, OR > const &from)
 Assignment from a different container type. More...
 
Dereferencing

Returns the mapped item the iterator currently points to.

reference operator* () const
 
reference operator-> () const
 Returns a member of the mapped item the iterator currently points to. More...
 
reference operator[] (difference_type n) const
 
Transformation

Increments this iterator and returns it incremented.

Iterator_toperator++ ()
 
Iterator_t operator++ (int)
 Increments this iterator and returns its old value. More...
 
Iterator_toperator-- ()
 Decrements this iterator and returns it decremented. More...
 
Iterator_t operator-- (int)
 Decrements this iterator and returns its old value. More...
 
Iterator_toperator+= (difference_type n)
 Increments this iterator by n steps and returns it incremented. More...
 
Iterator_toperator-= (difference_type n)
 Decrements this iterator by n steps and returns it decremented. More...
 
Iterator_t operator+ (difference_type n) const
 Returns an iterator pointing n steps ahead of this one. More...
 
Iterator_t operator- (difference_type n) const
 Returns an iterator pointing n steps behind this one. More...
 
difference_type operator- (Iterator_t &other) const
 Returns the number of steps this iterator is ahead of other. More...
 
Comparisons

Returns whether this iterator is equal to other.

template<typename OC , typename OR >
bool operator== (IteratorBase< OC, OR > const &other) const
 
template<typename OC , typename OR >
bool operator!= (IteratorBase< OC, OR > const &other) const
 Returns whether this iterator is not equal to other. More...
 
template<typename OC , typename OR >
bool operator<= (IteratorBase< OC, OR > const &other) const
 Returns whether this iterator is behind of or equal to other. More...
 
template<typename OC , typename OR >
bool operator< (IteratorBase< OC, OR > const &other) const
 Returns whether this iterator is strictly behind of other. More...
 
template<typename OC , typename OR >
bool operator>= (IteratorBase< OC, OR > const &other) const
 Returns whether this iterator is ahead of or equal to other. More...
 
template<typename OC , typename OR >
bool operator> (IteratorBase< OC, OR > const &other) const
 Returns whether this iterator is strictly ahead of other. More...
 

Private Types

using Container_t = Container
 
using Reference_t = Reference
 
using Iterator_t = IteratorBase< Container_t, Reference_t >
 This type. More...
 

Private Attributes

Container_tfCont = nullptr
 Pointer to the container. More...
 
MappingIndex_t fIndex = InvalidIndex
 Current index in container. More...
 

Detailed Description

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
class util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >

Definition at line 148 of file MappedContainer.h.

Member Typedef Documentation

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
using util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::Container_t = Container
private

Definition at line 550 of file MappedContainer.h.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
using util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::difference_type = typename Container_t::difference_type

Definition at line 566 of file MappedContainer.h.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
using util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::iterator_category = std::input_iterator_tag

Definition at line 570 of file MappedContainer.h.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
using util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::Iterator_t = IteratorBase<Container_t, Reference_t>
private

This type.

Definition at line 554 of file MappedContainer.h.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
using util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::pointer = decltype(&std::declval<reference>())

Definition at line 569 of file MappedContainer.h.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
using util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::reference = Reference_t

Definition at line 568 of file MappedContainer.h.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
using util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::Reference_t = Reference
private

Definition at line 551 of file MappedContainer.h.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
using util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::size_type = typename Container_t::size_type

Definition at line 567 of file MappedContainer.h.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
using util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::value_type = std::remove_cv_t<typename Container_t::value_type>

Definition at line 565 of file MappedContainer.h.

Constructor & Destructor Documentation

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::IteratorBase ( )
default

Constructor: an invalid iterator.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::IteratorBase ( Container_t cont,
MappingIndex_t  index 
)
inline

Constructor: iterator pointing to element index of cont.

Definition at line 580 of file MappedContainer.h.

581  : fCont(&cont), fIndex(index)
582  {}
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::IteratorBase ( Iterator_t const &  )
default

Copy constructor.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
template<typename OC , typename OR >
util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::IteratorBase ( IteratorBase< OC, OR > const &  from)
inline

Copy constructor: from a different container type.

Definition at line 589 of file MappedContainer.h.

590  : fCont(from.cont), fIndex(from.index)
591  {}
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.

Member Function Documentation

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
template<typename OC , typename OR >
bool util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator!= ( IteratorBase< OC, OR > const &  other) const
inline

Returns whether this iterator is not equal to other.

Definition at line 667 of file MappedContainer.h.

668  { return (fCont != other.fCont) || (fIndex != other.fIndex); }
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
reference util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator* ( ) const
inline

Definition at line 606 of file MappedContainer.h.

606 { return (*fCont)[fIndex]; }
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Iterator_t util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator+ ( difference_type  n) const
inline

Returns an iterator pointing n steps ahead of this one.

Definition at line 642 of file MappedContainer.h.

643  { auto it = *this; it += n; return it; }
std::void_t< T > n
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Iterator_t& util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator++ ( )
inline

Definition at line 624 of file MappedContainer.h.

624 { ++fIndex; return *this; }
MappingIndex_t fIndex
Current index in container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Iterator_t util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator++ ( int  )
inline

Increments this iterator and returns its old value.

Definition at line 627 of file MappedContainer.h.

627 { auto it = *this; this->operator++(); return it; }
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Iterator_t& util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator+= ( difference_type  n)
inline

Increments this iterator by n steps and returns it incremented.

Definition at line 636 of file MappedContainer.h.

636 { fIndex += n; return *this; }
MappingIndex_t fIndex
Current index in container.
std::void_t< T > n
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Iterator_t util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator- ( difference_type  n) const
inline

Returns an iterator pointing n steps behind this one.

Definition at line 646 of file MappedContainer.h.

647  { auto it = *this; it -= n; return it; }
std::void_t< T > n
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
difference_type util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator- ( Iterator_t other) const
inline

Returns the number of steps this iterator is ahead of other.

Definition at line 650 of file MappedContainer.h.

651  { return fIndex - other.fIndex; }
MappingIndex_t fIndex
Current index in container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Iterator_t& util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator-- ( )
inline

Decrements this iterator and returns it decremented.

Definition at line 630 of file MappedContainer.h.

630 { --fIndex; return *this; }
MappingIndex_t fIndex
Current index in container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Iterator_t util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator-- ( int  )
inline

Decrements this iterator and returns its old value.

Definition at line 633 of file MappedContainer.h.

633 { auto it = *this; this->operator--(); return it; }
Iterator_t & operator--()
Decrements this iterator and returns it decremented.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Iterator_t& util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator-= ( difference_type  n)
inline

Decrements this iterator by n steps and returns it decremented.

Definition at line 639 of file MappedContainer.h.

639 { fIndex -= n; return *this; }
MappingIndex_t fIndex
Current index in container.
std::void_t< T > n
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
reference util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator-> ( ) const
inline

Returns a member of the mapped item the iterator currently points to.

Definition at line 609 of file MappedContainer.h.

609 { return &(operator*(fIndex)); }
MappingIndex_t fIndex
Current index in container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
template<typename OC , typename OR >
bool util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator< ( IteratorBase< OC, OR > const &  other) const
inline

Returns whether this iterator is strictly behind of other.

Definition at line 677 of file MappedContainer.h.

678  { return (fCont == other.fCont) && (fIndex < other.fIndex); }
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
template<typename OC , typename OR >
bool util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator<= ( IteratorBase< OC, OR > const &  other) const
inline

Returns whether this iterator is behind of or equal to other.

Definition at line 672 of file MappedContainer.h.

673  { return (fCont == other.fCont) && (fIndex <= other.fIndex); }
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Iterator_t& util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator= ( Iterator_t const &  )
default

Copy assignment.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
template<typename OC , typename OR >
Iterator_t& util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator= ( IteratorBase< OC, OR > const &  from)
inline

Assignment from a different container type.

Definition at line 598 of file MappedContainer.h.

599  { fCont = from.fCont; fIndex = from.fIndex; return *this; }
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
template<typename OC , typename OR >
bool util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator== ( IteratorBase< OC, OR > const &  other) const
inline

Definition at line 662 of file MappedContainer.h.

663  { return (fCont == other.fCont) && (fIndex == other.fIndex); }
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
template<typename OC , typename OR >
bool util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator> ( IteratorBase< OC, OR > const &  other) const
inline

Returns whether this iterator is strictly ahead of other.

Definition at line 687 of file MappedContainer.h.

688  { return (fCont == other.fCont) && (fIndex > other.fIndex); }
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
template<typename OC , typename OR >
bool util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator>= ( IteratorBase< OC, OR > const &  other) const
inline

Returns whether this iterator is ahead of or equal to other.

Definition at line 682 of file MappedContainer.h.

683  { return (fCont == other.fCont) && (fIndex >= other.fIndex); }
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
reference util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator[] ( difference_type  n) const
inline

Returns the mapped item n steps ahead of what the iterator currentlt points to.

Definition at line 613 of file MappedContainer.h.

614  { return (*fCont)[fIndex + n]; }
MappingIndex_t fIndex
Current index in container.
std::void_t< T > n
Container_t * fCont
Pointer to the container.

Member Data Documentation

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Container_t* util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fCont = nullptr
private

Pointer to the container.

Definition at line 556 of file MappedContainer.h.

template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
MappingIndex_t util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fIndex = InvalidIndex
private

Current index in container.

Definition at line 557 of file MappedContainer.h.


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