Classes | Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
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
 
using pointer = typename traits_t::pointer
 
using reference = typename traits_t::reference
 
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 >
 

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 31 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 36 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 42 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 37 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 >

Definition at line 57 of file RangeForWrapper.h.

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

Definition at line 44 of file RangeForWrapper.h.

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

Definition at line 45 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 38 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 33 of file RangeForWrapper.h.

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

Definition at line 43 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 61 of file RangeForWrapper.h.

62  : fIter(end_t{})
63  {}
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 66 of file RangeForWrapper.h.

68  {}
boost::variant< begin_t, end_t > fIter
The actual iterator we store.
def move(depos, offset)
Definition: depos.py:107
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
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 71 of file RangeForWrapper.h.

72  : fIter(std::move(end))
73  {}
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.
def move(depos, offset)
Definition: depos.py:107

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 100 of file RangeForWrapper.h.

101  { return boost::apply_visitor(Comparer(), fIter, other.fIter); }
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 76 of file RangeForWrapper.h.

77  { 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 84 of file RangeForWrapper.h.

85  { boost::apply_visitor(Incrementer(), fIter); return *this; }
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 92 of file RangeForWrapper.h.

93  { auto old = *this; this_t::operator++(); return old; }
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 111 of file RangeForWrapper.h.

112  { return boost::apply_visitor(Difference(), fIter, other.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

Decrements the iterator (prefix operator).

Definition at line 88 of file RangeForWrapper.h.

89  { boost::apply_visitor(Decrementer(), fIter); return *this; }
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 96 of file RangeForWrapper.h.

97  { auto old = *this; this_t::operator--(); return old; }
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 80 of file RangeForWrapper.h.

81  { 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 104 of file RangeForWrapper.h.

105  { 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 108 of file RangeForWrapper.h.

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

Member Data Documentation

template<typename BeginIter , typename EndIter >
boost::variant<begin_t, end_t> util::details::RangeForWrapperIterator< BeginIter, EndIter >::fIter
private

The actual iterator we store.

Definition at line 117 of file RangeForWrapper.h.


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