All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
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 63 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 76 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 80 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 64 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 78 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 79 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 65 of file DereferenceIterator.h.

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

Definition at line 77 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 89 of file DereferenceIterator.h.

90  : 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 93 of file DereferenceIterator.h.

94  : 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 101 of file DereferenceIterator.h.

102  : iter(other.iter)
103  {
105  "Copying from a iterator with incompatible value"
106  );
107  }
temporary value
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 114 of file DereferenceIterator.h.

115  : iter(std::move(other.iter))
116  {
118  "Moving from a iterator with incompatible value"
119  );
120  }
temporary value

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 163 of file DereferenceIterator.h.

163 { 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

Definition at line 170 of file DereferenceIterator.h.

171  { return other.iter != iter; }
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 124 of file DereferenceIterator.h.

124 { 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 146 of file DereferenceIterator.h.

147  { return { iter + offset }; }
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
Definition: CORSIKAGen.fcl:7
template<typename Iter, typename Value>
this_t& lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator++ ( )
inline

Prefix increment 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 increment 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

Definition at line 151 of file DereferenceIterator.h.

152  { iter += offset; return *this; }
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
Definition: CORSIKAGen.fcl:7
template<typename Iter, typename Value>
this_t lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator- ( difference_type  offset) const
inline

Definition at line 148 of file DereferenceIterator.h.

149  { return { iter - offset }; }
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
Definition: CORSIKAGen.fcl:7
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 159 of file DereferenceIterator.h.

160  { 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 136 of file DereferenceIterator.h.

136 { --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 142 of file DereferenceIterator.h.

142 { 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

Definition at line 153 of file DereferenceIterator.h.

154  { iter -= offset; return *this; }
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
Definition: CORSIKAGen.fcl:7
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 127 of file DereferenceIterator.h.

127 { return *iter; }
template<typename Iter, typename Value>
bool lar::util::detail::DereferenceIteratorBase< Iter, Value >::operator< ( this_t const &  other) const
inline

Definition at line 176 of file DereferenceIterator.h.

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

Definition at line 172 of file DereferenceIterator.h.

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

Definition at line 168 of file DereferenceIterator.h.

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

Definition at line 178 of file DereferenceIterator.h.

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

Definition at line 174 of file DereferenceIterator.h.

175  { return other.iter >= iter; }
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 130 of file DereferenceIterator.h.

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

Member Data Documentation

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

wrapper iterator

Definition at line 67 of file DereferenceIterator.h.


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