File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
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).

Public Member Functions

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

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 boost::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

Constructor from a HyperRectDomain iterator.

Definition at line 84 of file HyperRectDomain_Iterator.h.

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 }

◆ 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 }

◆ 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 }

◆ 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 {
128 }

◆ 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 }

◆ 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 }

Field Documentation

◆ current

◆ prev

template<typename TIterator>
Iterator DGtal::HyperRectDomain_ReverseIterator< TIterator >::prev
private

Definition at line 131 of file HyperRectDomain_Iterator.h.


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