LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lar::util::detail::DereferenceIteratorBase< Iter, Value > Class Template Reference

Base class for dereferencing iterators. More...

#include "DereferenceIterator.h"

Classes

struct  initialize_tag
 Tag used for initialization. More...
 

Public Types

Type definitions for standard iterators
using difference_type = typename iterator_t::difference_type
 
using value_type = Value
 
using pointer = std::add_pointer_t< value_type >
 
using reference = std::add_lvalue_reference_t< value_type >
 
using iterator_category = typename iterator_t::iterator_category
 

Public Member Functions

 DereferenceIteratorBase ()=default
 Default constructor. More...
 
 DereferenceIteratorBase (Iter const &iter, initialize_tag)
 Constructor: copies the specified iterator in. More...
 
 DereferenceIteratorBase (Iter &&iter, initialize_tag)
 Constructor: acquires the specified iterator. More...
 
template<typename OtherIter , typename OtherValue >
 DereferenceIteratorBase (DereferenceIteratorBase< iterator_t, OtherValue > const &other)
 Generic copy constructor. More...
 
template<typename OtherIter , typename OtherValue >
 DereferenceIteratorBase (DereferenceIteratorBase< iterator_t, OtherValue > &&other)
 Generic move constructor. More...
 
reference operator* () const
 Returns a reference to the data pointed by the original iterator. More...
 
pointer operator-> () const
 Returns a reference to the data pointed by the original iterator. More...
 
reference operator[] (difference_type i) const
 Returns a reference to the i-th element after the pointed one. More...
 
this_toperator++ ()
 Prefix increment operator. More...
 
this_toperator-- ()
 Prefix decrement operator. More...
 
this_t operator++ (int)
 Postfix increment operator. More...
 
this_t operator-- (int)
 Postfix decrement operator. More...
 
difference_type operator- (this_t const &other) const
 Returns the difference from another iterator. More...
 
bool is_null () const
 Bonus: returns true if the pointer is not dereferentiable. More...
 
this_t operator+ (difference_type offset) const
 
this_t operator- (difference_type offset) const
 
this_toperator+= (difference_type offset)
 
this_toperator-= (difference_type offset)
 
Comparison operators between iterators
bool operator== (this_t const &other) const
 
bool operator!= (this_t const &other) const
 
bool operator<= (this_t const &other) const
 
bool operator>= (this_t const &other) const
 
bool operator< (this_t const &other) const
 
bool operator> (this_t const &other) const
 

Private Types

using iterator_t = Iter
 wrapped iterator type More...
 
using this_t = DereferenceIteratorBase< Iter, Value >
 this type More...
 

Private Attributes

iterator_t iter
 wrapper iterator More...
 

Detailed Description

template<typename Iter, typename Value>
class lar::util::detail::DereferenceIteratorBase< Iter, Value >

Base class for dereferencing iterators.

Definition at line 60 of file DereferenceIterator.h.

Member Typedef Documentation

template<typename Iter, typename Value>
using lar::util::detail::DereferenceIteratorBase< Iter, Value >::difference_type = typename iterator_t::difference_type

Definition at line 73 of file DereferenceIterator.h.

template<typename Iter, typename Value>
using lar::util::detail::DereferenceIteratorBase< Iter, Value >::iterator_category = typename iterator_t::iterator_category

Definition at line 77 of file DereferenceIterator.h.

template<typename Iter, typename Value>
using lar::util::detail::DereferenceIteratorBase< Iter, Value >::iterator_t = Iter
private

wrapped iterator type

Definition at line 61 of file DereferenceIterator.h.

template<typename Iter, typename Value>
using lar::util::detail::DereferenceIteratorBase< Iter, Value >::pointer = std::add_pointer_t<value_type>

Definition at line 75 of file DereferenceIterator.h.

template<typename Iter, typename Value>
using lar::util::detail::DereferenceIteratorBase< Iter, Value >::reference = std::add_lvalue_reference_t<value_type>

Definition at line 76 of file DereferenceIterator.h.

template<typename Iter, typename Value>
using lar::util::detail::DereferenceIteratorBase< Iter, Value >::this_t = DereferenceIteratorBase<Iter, Value>
private

this type

Definition at line 62 of file DereferenceIterator.h.

template<typename Iter, typename Value>
using lar::util::detail::DereferenceIteratorBase< Iter, Value >::value_type = Value

Definition at line 74 of file DereferenceIterator.h.

Constructor & Destructor Documentation

template<typename Iter, typename Value>
lar::util::detail::DereferenceIteratorBase< Iter, Value >::DereferenceIteratorBase ( )
default

Default constructor.

template<typename Iter, typename Value>
lar::util::detail::DereferenceIteratorBase< Iter, Value >::DereferenceIteratorBase ( Iter const &  iter,
initialize_tag   
)
inline

Constructor: copies the specified iterator in.

Definition at line 86 of file DereferenceIterator.h.

87  : iter(iter) {}
template<typename Iter, typename Value>
lar::util::detail::DereferenceIteratorBase< Iter, Value >::DereferenceIteratorBase ( Iter &&  iter,
initialize_tag   
)
inline

Constructor: acquires the specified iterator.

Definition at line 90 of file DereferenceIterator.h.

91  : iter(std::move(iter)) {}
template<typename Iter, typename Value>
template<typename OtherIter , typename OtherValue >
lar::util::detail::DereferenceIteratorBase< Iter, Value >::DereferenceIteratorBase ( DereferenceIteratorBase< iterator_t, OtherValue > const &  other)
inline

Generic copy constructor.

Template Parameters
OtherIterbase iterator: must be assignable to iterator_t
OtherValuevalue type: must be convertible into value_type

Definition at line 98 of file DereferenceIterator.h.

References fhicl::detail::atom::value().

99  : iter(other.iter)
100  {
102  "Copying from a iterator with incompatible value"
103  );
104  }
std::string value(boost::any const &)
template<typename Iter, typename Value>
template<typename OtherIter , typename OtherValue >
lar::util::detail::DereferenceIteratorBase< Iter, Value >::DereferenceIteratorBase ( DereferenceIteratorBase< iterator_t, OtherValue > &&  other)
inline

Generic move constructor.

Template Parameters
OtherIterbase iterator: must be assignable to iterator_t
OtherValuevalue type: must be convertible into value_type

Definition at line 111 of file DereferenceIterator.h.

References fhicl::detail::atom::value().

112  : iter(std::move(other.iter))
113  {
115  "Moving from a iterator with incompatible value"
116  );
117  }
std::string value(boost::any const &)

Member Function Documentation

template<typename Iter, typename Value>
bool lar::util::detail::DereferenceIteratorBase< Iter, Value >::is_null ( ) const
inline

Bonus: returns true if the pointer is not dereferentiable.

Definition at line 160 of file DereferenceIterator.h.

References operator*().

160 { return iterator_t::operator* () == nullptr; }
QuadExpr operator*(double v, const QuadExpr &e)
Definition: QuadExpr.h:39
template<typename Iter, typename Value>
bool lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator!= ( this_t const &  other) const
inline
template<typename Iter, typename Value>
reference lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator* ( ) const
inline

Returns a reference to the data pointed by the original iterator.

Definition at line 121 of file DereferenceIterator.h.

121 { return **iter; }
template<typename Iter, typename Value>
this_t lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator+ ( difference_type  offset) const
inline

Arithmetic operators (symmetric)

Definition at line 143 of file DereferenceIterator.h.

144  { return { iter + offset }; }
template<typename Iter, typename Value>
this_t& lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator++ ( )
inline

Prefix increment operator.

Definition at line 130 of file DereferenceIterator.h.

130 { ++iter; return *this; }
template<typename Iter, typename Value>
this_t lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator++ ( int  )
inline

Postfix increment operator.

Definition at line 136 of file DereferenceIterator.h.

136 { return this_t(iter++, {}); }
DereferenceIteratorBase< Iter, Value > this_t
this type
template<typename Iter, typename Value>
this_t& lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator+= ( difference_type  offset)
inline

Arithmetic operators (symmetric)

Definition at line 148 of file DereferenceIterator.h.

149  { iter += offset; return *this; }
template<typename Iter, typename Value>
this_t lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator- ( difference_type  offset) const
inline

Arithmetic operators (symmetric)

Definition at line 145 of file DereferenceIterator.h.

146  { return { iter - offset }; }
template<typename Iter, typename Value>
difference_type lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator- ( this_t const &  other) const
inline

Returns the difference from another iterator.

Definition at line 156 of file DereferenceIterator.h.

References lar::util::detail::DereferenceIteratorBase< Iter, Value >::iter.

157  { return iter - other.iter; }
template<typename Iter, typename Value>
this_t& lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator-- ( )
inline

Prefix decrement operator.

Definition at line 133 of file DereferenceIterator.h.

133 { --iter; return *this; }
template<typename Iter, typename Value>
this_t lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator-- ( int  )
inline

Postfix decrement operator.

Definition at line 139 of file DereferenceIterator.h.

139 { return this_t(iter--, {}); }
DereferenceIteratorBase< Iter, Value > this_t
this type
template<typename Iter, typename Value>
this_t& lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator-= ( difference_type  offset)
inline

Arithmetic operators (symmetric)

Definition at line 150 of file DereferenceIterator.h.

151  { iter -= offset; return *this; }
template<typename Iter, typename Value>
pointer lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator-> ( ) const
inline

Returns a reference to the data pointed by the original iterator.

Definition at line 124 of file DereferenceIterator.h.

124 { return *iter; }
template<typename Iter, typename Value>
bool lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator< ( this_t const &  other) const
inline
template<typename Iter, typename Value>
bool lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator<= ( this_t const &  other) const
inline
template<typename Iter, typename Value>
bool lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator== ( this_t const &  other) const
inline
template<typename Iter, typename Value>
bool lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator> ( this_t const &  other) const
inline
template<typename Iter, typename Value>
bool lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator>= ( this_t const &  other) const
inline
template<typename Iter, typename Value>
reference lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator[] ( difference_type  i) const
inline

Returns a reference to the i-th element after the pointed one.

Definition at line 127 of file DereferenceIterator.h.

127 { return *(iter[i]); }

Member Data Documentation


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