LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geo::vect::CoordConstIterator< Vector > Class Template Reference

Constant iterator to vector coordinates. More...

#include "geo_vectors_utils.h"

Public Types

using iterator_t = CoordConstIterator< Vector >
 Type of this iterator. More...
 
Iterator traits

— BEGIN Iterator traits ---------------------------------------------—

using value_type = std::remove_cv_t< Coord_t >
 
using difference_type = std::ptrdiff_t
 
using reference = Coord_t
 
using pointer = Coord_t const *
 
using iterator_category = std::random_access_iterator_tag
 

Public Member Functions

 CoordConstIterator ()=default
 Default constructor: invalid iterator. More...
 
 CoordConstIterator (Vector &v, unsigned int index=0)
 Constructor: points to index coordinate of vector v. More...
 
Access
reference operator* () const
 Access the current coordinate. More...
 
reference operator[] (difference_type n) const
 Access the current coordinate. More...
 
Moving
iterator_toperator++ ()
 Points to the next coordinate (unchecked). More...
 
iterator_t operator++ (int)
 Points to the next coordinate (unchecked), returns the previous iterator. More...
 
iterator_toperator-- ()
 Points to the previous coordinate (unchecked). More...
 
iterator_t operator-- (int)
 Points to previous coordinate (unchecked), returns the previous iterator. More...
 
iterator_toperator+= (difference_type d)
 Increments the iterator by d positions (unchecked). More...
 
iterator_t operator+ (difference_type d) const
 Returns an iterator incremented by d positions (unchecked). More...
 
iterator_toperator-= (difference_type d)
 Decrements the iterator by d positions (unchecked). More...
 
iterator_t operator- (difference_type d) const
 Returns an iterator decremented by d positions (unchecked). More...
 
iterator_t operator- (iterator_t const &other) const
 Returns the distance from another iterator. More...
 
Comparison operators

All comparisons between iterators on different vectors fail.

bool operator== (iterator_t const &other) const
 
bool operator!= (iterator_t const &other) const
 
bool operator<= (iterator_t const &other) const
 
bool operator>= (iterator_t const &other) const
 
bool operator< (iterator_t const &other) const
 
bool operator> (iterator_t const &other) const
 

Private Types

using Vector_t = Vector
 
using Coord_t = geo::vect::coordinate_t< Vector_t >
 Type of vector coordinate. More...
 

Private Member Functions

decltype(auto) access (unsigned int c) const
 
iterator_t copy () const
 

Private Attributes

Vector * v = nullptr
 
unsigned int index = std::numeric_limits<unsigned int>::max()
 

Detailed Description

template<typename Vector>
class geo::vect::CoordConstIterator< Vector >

Constant iterator to vector coordinates.

Template Parameters
Vectorthe type of vector being iterated
See also
vector_cbegin(), vector_cend(), iterateCoords()
Todo:
Not fully unit-tested yet!

Definition at line 955 of file geo_vectors_utils.h.

Member Typedef Documentation

template<typename Vector>
using geo::vect::CoordConstIterator< Vector >::Coord_t = geo::vect::coordinate_t<Vector_t>
private

Type of vector coordinate.

Definition at line 963 of file geo_vectors_utils.h.

template<typename Vector>
using geo::vect::CoordConstIterator< Vector >::difference_type = std::ptrdiff_t

Definition at line 977 of file geo_vectors_utils.h.

template<typename Vector>
using geo::vect::CoordConstIterator< Vector >::iterator_category = std::random_access_iterator_tag

Definition at line 980 of file geo_vectors_utils.h.

template<typename Vector>
using geo::vect::CoordConstIterator< Vector >::iterator_t = CoordConstIterator<Vector>

Type of this iterator.

Definition at line 958 of file geo_vectors_utils.h.

template<typename Vector>
using geo::vect::CoordConstIterator< Vector >::pointer = Coord_t const*

Definition at line 979 of file geo_vectors_utils.h.

template<typename Vector>
using geo::vect::CoordConstIterator< Vector >::reference = Coord_t

Definition at line 978 of file geo_vectors_utils.h.

template<typename Vector>
using geo::vect::CoordConstIterator< Vector >::value_type = std::remove_cv_t<Coord_t>

Definition at line 976 of file geo_vectors_utils.h.

template<typename Vector>
using geo::vect::CoordConstIterator< Vector >::Vector_t = Vector
private

Type of vector being iterated.

Definition at line 961 of file geo_vectors_utils.h.

Constructor & Destructor Documentation

template<typename Vector>
geo::vect::CoordConstIterator< Vector >::CoordConstIterator ( )
default

Default constructor: invalid iterator.

— END Iterator traits --------------------------------------------——

template<typename Vector>
geo::vect::CoordConstIterator< Vector >::CoordConstIterator ( Vector &  v,
unsigned int  index = 0 
)
inline

Constructor: points to index coordinate of vector v.

Definition at line 988 of file geo_vectors_utils.h.

Member Function Documentation

template<typename Vector>
decltype(auto) geo::vect::CoordConstIterator< Vector >::access ( unsigned int  c) const
inlineprivate

Definition at line 968 of file geo_vectors_utils.h.

References geo::vect::bindCoord().

968 { return geo::vect::bindCoord(v, index); }
constexpr auto bindCoord(Vector const &v, CoordReader_t< Vector > helper)
Binds the specified constant vector to the coordinate reader.
template<typename Vector>
iterator_t geo::vect::CoordConstIterator< Vector >::copy ( ) const
inlineprivate

Definition at line 970 of file geo_vectors_utils.h.

970 { return *this; }
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator!= ( iterator_t const &  other) const
inline
template<typename Vector>
reference geo::vect::CoordConstIterator< Vector >::operator* ( ) const
inline

Access the current coordinate.

Definition at line 995 of file geo_vectors_utils.h.

References geo::vect::coord().

995 { return geo::vect::coord(*v, index); }
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
template<typename Vector>
iterator_t geo::vect::CoordConstIterator< Vector >::operator+ ( difference_type  d) const
inline

Returns an iterator incremented by d positions (unchecked).

Definition at line 1045 of file geo_vectors_utils.h.

1045 { return (copy() += d); }
Float_t d
Definition: plot.C:235
template<typename Vector>
iterator_t& geo::vect::CoordConstIterator< Vector >::operator++ ( )
inline

Points to the next coordinate (unchecked).

Definition at line 1008 of file geo_vectors_utils.h.

1009  {
1010  ++index;
1011  return *this;
1012  }
template<typename Vector>
iterator_t geo::vect::CoordConstIterator< Vector >::operator++ ( int  )
inline

Points to the next coordinate (unchecked), returns the previous iterator.

Definition at line 1015 of file geo_vectors_utils.h.

1016  {
1017  iterator_t it(*this);
1018  ++index;
1019  return it;
1020  }
CoordConstIterator< Vector > iterator_t
Type of this iterator.
template<typename Vector>
iterator_t& geo::vect::CoordConstIterator< Vector >::operator+= ( difference_type  d)
inline

Increments the iterator by d positions (unchecked).

Definition at line 1038 of file geo_vectors_utils.h.

References d.

1039  {
1040  index += d;
1041  return *this;
1042  }
Float_t d
Definition: plot.C:235
template<typename Vector>
iterator_t geo::vect::CoordConstIterator< Vector >::operator- ( difference_type  d) const
inline

Returns an iterator decremented by d positions (unchecked).

Definition at line 1055 of file geo_vectors_utils.h.

1055 { return (copy() -= d); }
Float_t d
Definition: plot.C:235
template<typename Vector>
iterator_t geo::vect::CoordConstIterator< Vector >::operator- ( iterator_t const &  other) const
inline

Returns the distance from another iterator.

Definition at line 1058 of file geo_vectors_utils.h.

References geo::vect::CoordConstIterator< Vector >::index.

1058 { return index - other.index; }
template<typename Vector>
iterator_t& geo::vect::CoordConstIterator< Vector >::operator-- ( )
inline

Points to the previous coordinate (unchecked).

Definition at line 1023 of file geo_vectors_utils.h.

1024  {
1025  --index;
1026  return *this;
1027  }
template<typename Vector>
iterator_t geo::vect::CoordConstIterator< Vector >::operator-- ( int  )
inline

Points to previous coordinate (unchecked), returns the previous iterator.

Definition at line 1030 of file geo_vectors_utils.h.

1031  {
1032  iterator_t it(*this);
1033  --index;
1034  return it;
1035  }
CoordConstIterator< Vector > iterator_t
Type of this iterator.
template<typename Vector>
iterator_t& geo::vect::CoordConstIterator< Vector >::operator-= ( difference_type  d)
inline

Decrements the iterator by d positions (unchecked).

Definition at line 1048 of file geo_vectors_utils.h.

References d.

1049  {
1050  index -= d;
1051  return *this;
1052  }
Float_t d
Definition: plot.C:235
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator< ( iterator_t const &  other) const
inline
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator<= ( iterator_t const &  other) const
inline
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator== ( iterator_t const &  other) const
inline
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator> ( iterator_t const &  other) const
inline
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator>= ( iterator_t const &  other) const
inline
template<typename Vector>
reference geo::vect::CoordConstIterator< Vector >::operator[] ( difference_type  n) const
inline

Access the current coordinate.

Definition at line 998 of file geo_vectors_utils.h.

References geo::vect::coord().

998 { return geo::vect::coord(*v, index + n); }
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
Char_t n[5]

Member Data Documentation


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