LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
util::details::RangeForWrapperIterator< BeginIter, EndIter > Class Template Reference

#include "RangeForWrapper.h"

Classes

struct  Comparer
 Visitor to compare iterators (returns whether they differ). More...
 
struct  Decrementer
 Visitor to decrement an iterator. More...
 
struct  Dereferencer
 Visitor to dereference an iterator. More...
 
struct  Difference
 Visitor to compare iterators (returns whether they differ). More...
 
struct  Incrementer
 Visitor to increment an iterator. More...
 
struct  IndexAccessor
 Visitor to access element by index. More...
 
struct  MemberAccessor
 Visitor to access a data member of the pointed class. More...
 

Public Types

using begin_t = BeginIter
 Type of begin iterator we can store. More...
 
using end_t = EndIter
 Type of end iterator we can store. More...
 
using this_t = RangeForWrapperIterator< begin_t, end_t >
 This class. More...
 
using difference_type = typename traits_t::difference_type
 Iterator traits, imported from the wrapped begin iterator. More...
 
using value_type = typename traits_t::value_type
 Iterator traits, imported from the wrapped begin iterator. More...
 
using pointer = typename traits_t::pointer
 Iterator traits, imported from the wrapped begin iterator. More...
 
using reference = typename traits_t::reference
 Iterator traits, imported from the wrapped begin iterator. More...
 
using iterator_category = std::conditional_t< std::is_base_of< std::bidirectional_iterator_tag, typename traits_t::iterator_category >::value, std::bidirectional_iterator_tag, typename traits_t::iterator_category >
 Iterator traits, imported from the wrapped begin iterator. More...
 

Public Member Functions

 RangeForWrapperIterator ()
 Constructor: initializes with a end-type default-constructed iterator. More...
 
 RangeForWrapperIterator (begin_t &&begin)
 Constructor: initializes with a begin-type iterator. More...
 
 RangeForWrapperIterator (end_t &&end)
 Constructor: initializes with a end-type iterator. More...
 
reference operator* () const
 Returns the pointed value (just like the original iterator). More...
 
pointer operator-> () const
 Returns the pointed value (just like the original iterator). More...
 
this_toperator++ ()
 Increments the iterator (prefix operator). More...
 
this_toperator-- ()
 Decrements the iterator (prefix operator). More...
 
this_t operator++ (int)
 Increments the iterator (postfix operator). More...
 
this_t operator-- (int)
 Decrements the iterator (postfix operator). More...
 
bool operator!= (this_t const &other) const
 Returns whether the other iterator is not equal to this one. More...
 
bool operator== (this_t const &other) const
 Returns whether the other iterator is equal to this one. More...
 
reference operator[] (difference_type offset) const
 
difference_type operator- (this_t const &other) const
 

Private Types

using traits_t = std::iterator_traits< BeginIter >
 

Private Attributes

boost::variant< begin_t, end_tfIter
 The actual iterator we store. More...
 

Detailed Description

template<typename BeginIter, typename EndIter>
class util::details::RangeForWrapperIterator< BeginIter, EndIter >

Iterator wrapping one of two types of iterators.

See also
RangeForWrapperBox

Definition at line 30 of file RangeForWrapper.h.

Member Typedef Documentation

template<typename BeginIter , typename EndIter >
using util::details::RangeForWrapperIterator< BeginIter, EndIter >::begin_t = BeginIter

Type of begin iterator we can store.

Definition at line 35 of file RangeForWrapper.h.

template<typename BeginIter , typename EndIter >
using util::details::RangeForWrapperIterator< BeginIter, EndIter >::difference_type = typename traits_t::difference_type

Iterator traits, imported from the wrapped begin iterator.

Definition at line 41 of file RangeForWrapper.h.

template<typename BeginIter , typename EndIter >
using util::details::RangeForWrapperIterator< BeginIter, EndIter >::end_t = EndIter

Type of end iterator we can store.

Definition at line 36 of file RangeForWrapper.h.

template<typename BeginIter , typename EndIter >
using util::details::RangeForWrapperIterator< BeginIter, EndIter >::iterator_category = std::conditional_t<std::is_base_of<std::bidirectional_iterator_tag, typename traits_t::iterator_category>::value, std::bidirectional_iterator_tag, typename traits_t::iterator_category>

Iterator traits, imported from the wrapped begin iterator.

Definition at line 56 of file RangeForWrapper.h.

template<typename BeginIter , typename EndIter >
using util::details::RangeForWrapperIterator< BeginIter, EndIter >::pointer = typename traits_t::pointer

Iterator traits, imported from the wrapped begin iterator.

Definition at line 43 of file RangeForWrapper.h.

template<typename BeginIter , typename EndIter >
using util::details::RangeForWrapperIterator< BeginIter, EndIter >::reference = typename traits_t::reference

Iterator traits, imported from the wrapped begin iterator.

Definition at line 44 of file RangeForWrapper.h.

template<typename BeginIter , typename EndIter >
using util::details::RangeForWrapperIterator< BeginIter, EndIter >::this_t = RangeForWrapperIterator<begin_t, end_t>

This class.

Definition at line 37 of file RangeForWrapper.h.

template<typename BeginIter , typename EndIter >
using util::details::RangeForWrapperIterator< BeginIter, EndIter >::traits_t = std::iterator_traits<BeginIter>
private

Definition at line 32 of file RangeForWrapper.h.

template<typename BeginIter , typename EndIter >
using util::details::RangeForWrapperIterator< BeginIter, EndIter >::value_type = typename traits_t::value_type

Iterator traits, imported from the wrapped begin iterator.

Definition at line 42 of file RangeForWrapper.h.

Constructor & Destructor Documentation

template<typename BeginIter , typename EndIter >
util::details::RangeForWrapperIterator< BeginIter, EndIter >::RangeForWrapperIterator ( )
inlineexplicit

Constructor: initializes with a end-type default-constructed iterator.

Definition at line 60 of file RangeForWrapper.h.

60 : fIter(end_t{}) {}
EndIter end_t
Type of end iterator we can store.
boost::variant< begin_t, end_t > fIter
The actual iterator we store.
template<typename BeginIter , typename EndIter >
util::details::RangeForWrapperIterator< BeginIter, EndIter >::RangeForWrapperIterator ( begin_t &&  begin)
inlineexplicit

Constructor: initializes with a begin-type iterator.

Definition at line 63 of file RangeForWrapper.h.

63 : fIter(std::move(begin)) {}
boost::variant< begin_t, end_t > fIter
The actual iterator we store.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
template<typename BeginIter , typename EndIter >
util::details::RangeForWrapperIterator< BeginIter, EndIter >::RangeForWrapperIterator ( end_t &&  end)
inlineexplicit

Constructor: initializes with a end-type iterator.

Definition at line 66 of file RangeForWrapper.h.

66 : fIter(std::move(end)) {}
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
boost::variant< begin_t, end_t > fIter
The actual iterator we store.

Member Function Documentation

template<typename BeginIter , typename EndIter >
bool util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator!= ( this_t const &  other) const
inline

Returns whether the other iterator is not equal to this one.

Definition at line 105 of file RangeForWrapper.h.

References util::details::RangeForWrapperIterator< BeginIter, EndIter >::fIter.

Referenced by util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator==().

106  {
107  return boost::apply_visitor(Comparer(), fIter, other.fIter);
108  }
boost::variant< begin_t, end_t > fIter
The actual iterator we store.
template<typename BeginIter , typename EndIter >
reference util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator* ( ) const
inline

Returns the pointed value (just like the original iterator).

Definition at line 69 of file RangeForWrapper.h.

References util::details::RangeForWrapperIterator< BeginIter, EndIter >::fIter.

69 { return boost::apply_visitor(Dereferencer(), fIter); }
boost::variant< begin_t, end_t > fIter
The actual iterator we store.
template<typename BeginIter , typename EndIter >
this_t& util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator++ ( )
inline

Increments the iterator (prefix operator).

Definition at line 75 of file RangeForWrapper.h.

References util::details::RangeForWrapperIterator< BeginIter, EndIter >::fIter.

Referenced by util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator++().

76  {
77  boost::apply_visitor(Incrementer(), fIter);
78  return *this;
79  }
boost::variant< begin_t, end_t > fIter
The actual iterator we store.
template<typename BeginIter , typename EndIter >
this_t util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator++ ( int  )
inline

Increments the iterator (postfix operator).

Definition at line 89 of file RangeForWrapper.h.

References util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator++().

90  {
91  auto old = *this;
93  return old;
94  }
this_t & operator++()
Increments the iterator (prefix operator).
template<typename BeginIter , typename EndIter >
difference_type util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator- ( this_t const &  other) const
inline

Definition at line 118 of file RangeForWrapper.h.

References util::details::RangeForWrapperIterator< BeginIter, EndIter >::fIter, and value.

119  {
120  return boost::apply_visitor(Difference(), fIter, other.fIter);
121  }
boost::variant< begin_t, end_t > fIter
The actual iterator we store.
template<typename BeginIter , typename EndIter >
this_t& util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator-- ( )
inline

Decrements the iterator (prefix operator).

Definition at line 82 of file RangeForWrapper.h.

References util::details::RangeForWrapperIterator< BeginIter, EndIter >::fIter.

Referenced by util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator--().

83  {
84  boost::apply_visitor(Decrementer(), fIter);
85  return *this;
86  }
boost::variant< begin_t, end_t > fIter
The actual iterator we store.
template<typename BeginIter , typename EndIter >
this_t util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator-- ( int  )
inline

Decrements the iterator (postfix operator).

Definition at line 97 of file RangeForWrapper.h.

References util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator--().

98  {
99  auto old = *this;
101  return old;
102  }
this_t & operator--()
Decrements the iterator (prefix operator).
template<typename BeginIter , typename EndIter >
pointer util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator-> ( ) const
inline

Returns the pointed value (just like the original iterator).

Definition at line 72 of file RangeForWrapper.h.

References util::details::RangeForWrapperIterator< BeginIter, EndIter >::fIter.

72 { return boost::apply_visitor(MemberAccessor(), fIter); }
boost::variant< begin_t, end_t > fIter
The actual iterator we store.
template<typename BeginIter , typename EndIter >
bool util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator== ( this_t const &  other) const
inline

Returns whether the other iterator is equal to this one.

Definition at line 111 of file RangeForWrapper.h.

References util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator!=().

111 { return !(this->operator!=(other)); }
bool operator!=(this_t const &other) const
Returns whether the other iterator is not equal to this one.
template<typename BeginIter , typename EndIter >
reference util::details::RangeForWrapperIterator< BeginIter, EndIter >::operator[] ( difference_type  offset) const
inline

Definition at line 113 of file RangeForWrapper.h.

References util::details::RangeForWrapperIterator< BeginIter, EndIter >::fIter.

114  {
115  return boost::apply_visitor(IndexAccessor(offset), fIter);
116  }
boost::variant< begin_t, end_t > fIter
The actual iterator we store.

Member Data Documentation


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