LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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
 Returns a member of the mapped item the iterator currently points to. More...
 
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++ ()
 Increments this iterator and returns its old value. More...
 
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
 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 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 150 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 516 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 531 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 535 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 520 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 534 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 533 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 517 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 532 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 530 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 544 of file MappedContainer.h.

544 : fCont(&cont), fIndex(index) {}
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 551 of file MappedContainer.h.

551  : fCont(from.cont), fIndex(from.index)
552  {}
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 663 of file MappedContainer.h.

References util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fCont, and util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fIndex.

664  {
665  return (fCont != other.fCont) || (fIndex != other.fIndex);
666  }
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

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

Definition at line 570 of file MappedContainer.h.

570 { 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 630 of file MappedContainer.h.

References n.

631  {
632  auto it = *this;
633  it += n;
634  return it;
635  }
Char_t n[5]
template<typename Cont, typename Mapping>
template<typename Container, typename Reference>
Iterator_t& util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::operator++ ( )
inline

Increments this iterator and returns its old value.

Definition at line 586 of file MappedContainer.h.

587  {
588  ++fIndex;
589  return *this;
590  }
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 593 of file MappedContainer.h.

594  {
595  auto it = *this;
596  this->operator++();
597  return it;
598  }
Iterator_t & operator++()
Increments this iterator and returns its old value.
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 616 of file MappedContainer.h.

References n.

617  {
618  fIndex += n;
619  return *this;
620  }
MappingIndex_t fIndex
Current index in container.
Char_t n[5]
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 638 of file MappedContainer.h.

References n.

639  {
640  auto it = *this;
641  it -= n;
642  return it;
643  }
Char_t n[5]
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 646 of file MappedContainer.h.

References util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fIndex.

646 { 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 601 of file MappedContainer.h.

602  {
603  --fIndex;
604  return *this;
605  }
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 608 of file MappedContainer.h.

609  {
610  auto it = *this;
611  this->operator--();
612  return it;
613  }
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 623 of file MappedContainer.h.

References n.

624  {
625  fIndex -= n;
626  return *this;
627  }
MappingIndex_t fIndex
Current index in container.
Char_t n[5]
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 573 of file MappedContainer.h.

References operator*().

573 { return &(operator*(fIndex)); }
MappingIndex_t fIndex
Current index in container.
reference operator*() const
Returns a member of the mapped item the iterator currently points to.
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.

References fhicl::other.

678  {
679  return (fCont == other.fCont) && (fIndex < other.fIndex);
680  }
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 670 of file MappedContainer.h.

References fhicl::other.

671  {
672  return (fCont == other.fCont) && (fIndex <= other.fIndex);
673  }
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 559 of file MappedContainer.h.

References util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fCont, and util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fIndex.

560  {
561  fCont = from.fCont;
562  fIndex = from.fIndex;
563  return *this;
564  }
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 not equal to other.

Definition at line 656 of file MappedContainer.h.

References util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fCont, and util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fIndex.

657  {
658  return (fCont == other.fCont) && (fIndex == other.fIndex);
659  }
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 691 of file MappedContainer.h.

References util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fCont, and util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fIndex.

692  {
693  return (fCont == other.fCont) && (fIndex > other.fIndex);
694  }
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 684 of file MappedContainer.h.

References util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fCont, and util::MappedContainer< Cont, Mapping >::IteratorBase< Container, Reference >::fIndex.

685  {
686  return (fCont == other.fCont) && (fIndex >= other.fIndex);
687  }
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 577 of file MappedContainer.h.

References n.

577 { return (*fCont)[fIndex + n]; }
MappingIndex_t fIndex
Current index in container.
Container_t * fCont
Pointer to the container.
Char_t n[5]

Member Data Documentation


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