Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
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

Vectorv = 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 918 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 926 of file geo_vectors_utils.h.

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

Definition at line 942 of file geo_vectors_utils.h.

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

Definition at line 945 of file geo_vectors_utils.h.

Type of this iterator.

Definition at line 921 of file geo_vectors_utils.h.

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

Definition at line 944 of file geo_vectors_utils.h.

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

Definition at line 943 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 941 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 924 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 953 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 931 of file geo_vectors_utils.h.

932  { 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 934 of file geo_vectors_utils.h.

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

Definition at line 1017 of file geo_vectors_utils.h.

1018  { return (v != other.v) || (index != other.index); }
template<typename Vector>
reference geo::vect::CoordConstIterator< Vector >::operator* ( ) const
inline

Access the current coordinate.

Definition at line 962 of file geo_vectors_utils.h.

962 { 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 992 of file geo_vectors_utils.h.

992 { return (copy() += d); }
template<typename Vector>
iterator_t& geo::vect::CoordConstIterator< Vector >::operator++ ( )
inline

Points to the next coordinate (unchecked).

Definition at line 977 of file geo_vectors_utils.h.

977 { ++index; return *this; }
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 980 of file geo_vectors_utils.h.

980 { iterator_t it(*this); ++index; return it; }
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 989 of file geo_vectors_utils.h.

989 { index += d; return *this; }
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 998 of file geo_vectors_utils.h.

998 { return (copy() -= d); }
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 1001 of file geo_vectors_utils.h.

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

Points to the previous coordinate (unchecked).

Definition at line 983 of file geo_vectors_utils.h.

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

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

Definition at line 986 of file geo_vectors_utils.h.

986 { iterator_t it(*this); --index; return it; }
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 995 of file geo_vectors_utils.h.

995 { index -= d; return *this; }
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator< ( iterator_t const &  other) const
inline

Definition at line 1026 of file geo_vectors_utils.h.

1027  { return (v == other.v) && (index < other.index); }
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator<= ( iterator_t const &  other) const
inline

Definition at line 1020 of file geo_vectors_utils.h.

1021  { return (v == other.v) && (index <= other.index); }
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator== ( iterator_t const &  other) const
inline

Definition at line 1014 of file geo_vectors_utils.h.

1015  { return (v == other.v) && (index == other.index); }
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator> ( iterator_t const &  other) const
inline

Definition at line 1029 of file geo_vectors_utils.h.

1030  { return (v == other.v) && (index > other.index); }
template<typename Vector>
bool geo::vect::CoordConstIterator< Vector >::operator>= ( iterator_t const &  other) const
inline

Definition at line 1023 of file geo_vectors_utils.h.

1024  { return (v == other.v) && (index >= other.index); }
template<typename Vector>
reference geo::vect::CoordConstIterator< Vector >::operator[] ( difference_type  n) const
inline

Access the current coordinate.

Definition at line 965 of file geo_vectors_utils.h.

966  { 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.
std::void_t< T > n

Member Data Documentation

template<typename Vector>
unsigned int geo::vect::CoordConstIterator< Vector >::index = std::numeric_limits<unsigned int>::max()
private

Definition at line 929 of file geo_vectors_utils.h.

template<typename Vector>
Vector* geo::vect::CoordConstIterator< Vector >::v = nullptr
private

Definition at line 928 of file geo_vectors_utils.h.


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