DGtal  1.5.beta
DGtal::HyperRectDomain_ReverseIterator< TIterator > Class Template Reference

Reverse iterator for HyperRectDomain. More...

#include <DGtal/kernel/domains/HyperRectDomain_Iterator.h>

Inheritance diagram for DGtal::HyperRectDomain_ReverseIterator< TIterator >:
[legend]

Public Types

using Iterator = TIterator
 
using Self = HyperRectDomain_ReverseIterator< Iterator >
 
using Point = typename Iterator::Point
 
using Dimension = typename Point::Dimension
 
using DifferenceType = typename std::iterator_traits< Self >::difference_type
 Type of the difference between two iterators (usually std::ptrdiff_t except for BigInteger). More...
 

Public Member Functions

 HyperRectDomain_ReverseIterator (Iterator it)
 Constructor from a HyperRectDomain iterator. More...
 
const Pointdereference () const
 Dereference. More...
 
bool equal (const Self &other) const
 Compare iterators. More...
 
void increment ()
 Increment iterator. More...
 
void decrement ()
 Decrement iterator. More...
 
void advance (DifferenceType const &n)
 Advance iterator by given steps. More...
 
DifferenceType distance_to (const Self &other) const
 Distance between two iterators on the same domain. More...
 

Private Attributes

Iterator current
 
Iterator prev
 

Detailed Description

template<typename TIterator>
class DGtal::HyperRectDomain_ReverseIterator< TIterator >

Reverse iterator for HyperRectDomain.

Template Parameters
TIteratorIterator type on HyperRectDomain
Note
We need this specific implementation of a reverse iterator instead of a std::reverse_iterator because the latter works only on non-stashing iterators (i.e. iterators that don't own its pointed data). Otherwise, it will lead to dangling reference!

Definition at line 66 of file HyperRectDomain_Iterator.h.

Member Typedef Documentation

◆ DifferenceType

template<typename TIterator >
using DGtal::HyperRectDomain_ReverseIterator< TIterator >::DifferenceType = typename std::iterator_traits<Self>::difference_type

Type of the difference between two iterators (usually std::ptrdiff_t except for BigInteger).

Definition at line 80 of file HyperRectDomain_Iterator.h.

◆ Dimension

template<typename TIterator >
using DGtal::HyperRectDomain_ReverseIterator< TIterator >::Dimension = typename Point::Dimension

Definition at line 79 of file HyperRectDomain_Iterator.h.

◆ Iterator

template<typename TIterator >
using DGtal::HyperRectDomain_ReverseIterator< TIterator >::Iterator = TIterator

Definition at line 76 of file HyperRectDomain_Iterator.h.

◆ Point

template<typename TIterator >
using DGtal::HyperRectDomain_ReverseIterator< TIterator >::Point = typename Iterator::Point

Definition at line 78 of file HyperRectDomain_Iterator.h.

◆ Self

template<typename TIterator >
using DGtal::HyperRectDomain_ReverseIterator< TIterator >::Self = HyperRectDomain_ReverseIterator<Iterator>

Definition at line 77 of file HyperRectDomain_Iterator.h.

Constructor & Destructor Documentation

◆ HyperRectDomain_ReverseIterator()

template<typename TIterator >
DGtal::HyperRectDomain_ReverseIterator< TIterator >::HyperRectDomain_ReverseIterator ( Iterator  it)
inlineexplicit

Member Function Documentation

◆ advance()

template<typename TIterator >
void DGtal::HyperRectDomain_ReverseIterator< TIterator >::advance ( DifferenceType const &  n)
inline

Advance iterator by given steps.

Definition at line 118 of file HyperRectDomain_Iterator.h.

119  {
120  current -= n;
121  prev -= n;
122  }

References DGtal::HyperRectDomain_ReverseIterator< TIterator >::current, and DGtal::HyperRectDomain_ReverseIterator< TIterator >::prev.

◆ decrement()

template<typename TIterator >
void DGtal::HyperRectDomain_ReverseIterator< TIterator >::decrement ( )
inline

Decrement iterator.

Definition at line 111 of file HyperRectDomain_Iterator.h.

112  {
113  ++current;
114  ++prev;
115  }

References DGtal::HyperRectDomain_ReverseIterator< TIterator >::current, and DGtal::HyperRectDomain_ReverseIterator< TIterator >::prev.

◆ dereference()

template<typename TIterator >
const Point& DGtal::HyperRectDomain_ReverseIterator< TIterator >::dereference ( ) const
inline

Dereference.

Definition at line 92 of file HyperRectDomain_Iterator.h.

93  {
94  return *prev;
95  }

References DGtal::HyperRectDomain_ReverseIterator< TIterator >::prev.

◆ distance_to()

template<typename TIterator >
DifferenceType DGtal::HyperRectDomain_ReverseIterator< TIterator >::distance_to ( const Self other) const
inline

Distance between two iterators on the same domain.

Definition at line 125 of file HyperRectDomain_Iterator.h.

126  {
127  return std::distance(other.current, current);
128  }

References DGtal::HyperRectDomain_ReverseIterator< TIterator >::current.

◆ equal()

template<typename TIterator >
bool DGtal::HyperRectDomain_ReverseIterator< TIterator >::equal ( const Self other) const
inline

Compare iterators.

Definition at line 98 of file HyperRectDomain_Iterator.h.

99  {
100  return current == other.current;
101  }

References DGtal::HyperRectDomain_ReverseIterator< TIterator >::current.

◆ increment()

template<typename TIterator >
void DGtal::HyperRectDomain_ReverseIterator< TIterator >::increment ( )
inline

Increment iterator.

Definition at line 104 of file HyperRectDomain_Iterator.h.

105  {
106  --current;
107  --prev;
108  }

References DGtal::HyperRectDomain_ReverseIterator< TIterator >::current, and DGtal::HyperRectDomain_ReverseIterator< TIterator >::prev.

Field Documentation

◆ current

◆ prev


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