DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Types | Private Member Functions | Friends
DGtal::ReverseIterator< Iterator > Class Template Reference

This class adapts any bidirectional iterator so that operator++ calls operator-- and vice versa. More...

#include <DGtal/base/ReverseIterator.h>

Inheritance diagram for DGtal::ReverseIterator< Iterator >:

Public Types

typedef IteratorCirculatorTraits< Iterator >::Type Type
 

Public Member Functions

 ReverseIterator ()
 
 ReverseIterator (Iterator x)
 
template<class OtherIterator >
 ReverseIterator (ReverseIterator< OtherIterator > const &r, typename boost::enable_if_convertible< OtherIterator, Iterator >::type *=0)
 

Private Types

typedef boost::iterator_adaptor< ReverseIterator< Iterator >, Iterator > super_t
 

Private Member Functions

super_t::reference dereference () const
 
void increment ()
 
void decrement ()
 
void advance (typename super_t::difference_type n)
 
template<class OtherIterator >
super_t::difference_type distance_to (ReverseIterator< OtherIterator > const &y) const
 

Friends

class boost::iterator_core_access
 

Detailed Description

template<class Iterator>
class DGtal::ReverseIterator< Iterator >

This class adapts any bidirectional iterator so that operator++ calls operator-- and vice versa.

Description of template class 'ReverseIterator'

Template Parameters
Iteratorthe type of the iterator to adapt, a model of bidirectional iterator

NB: adapted from boost/iterator/ReverseIterator.hpp

Definition at line 68 of file ReverseIterator.h.

Member Typedef Documentation

◆ super_t

template<class Iterator >
typedef boost::iterator_adaptor< ReverseIterator<Iterator>, Iterator > DGtal::ReverseIterator< Iterator >::super_t
private

Definition at line 72 of file ReverseIterator.h.

◆ Type

template<class Iterator >
typedef IteratorCirculatorTraits<Iterator>::Type DGtal::ReverseIterator< Iterator >::Type

Definition at line 78 of file ReverseIterator.h.

Constructor & Destructor Documentation

◆ ReverseIterator() [1/3]

template<class Iterator >
DGtal::ReverseIterator< Iterator >::ReverseIterator ( )
inline

Definition at line 80 of file ReverseIterator.h.

80{}

◆ ReverseIterator() [2/3]

template<class Iterator >
DGtal::ReverseIterator< Iterator >::ReverseIterator ( Iterator  x)
inlineexplicit

Definition at line 82 of file ReverseIterator.h.

83 : super_t(x) {}
boost::iterator_adaptor< ReverseIterator< Iterator >, Iterator > super_t

◆ ReverseIterator() [3/3]

template<class Iterator >
template<class OtherIterator >
DGtal::ReverseIterator< Iterator >::ReverseIterator ( ReverseIterator< OtherIterator > const &  r,
typename boost::enable_if_convertible< OtherIterator, Iterator >::type *  = 0 
)
inline

Definition at line 86 of file ReverseIterator.h.

90 : super_t(r.base())
91 {}

Member Function Documentation

◆ advance()

template<class Iterator >
void DGtal::ReverseIterator< Iterator >::advance ( typename super_t::difference_type  n)
inlineprivate

Definition at line 99 of file ReverseIterator.h.

100 {
101 this->base_reference() += -n;
102 }

◆ decrement()

template<class Iterator >
void DGtal::ReverseIterator< Iterator >::decrement ( )
inlineprivate

Definition at line 97 of file ReverseIterator.h.

97{ ++this->base_reference(); }

◆ dereference()

template<class Iterator >
super_t::reference DGtal::ReverseIterator< Iterator >::dereference ( ) const
inlineprivate

Definition at line 94 of file ReverseIterator.h.

94{ return *boost::prior(this->base()); }

◆ distance_to()

template<class Iterator >
template<class OtherIterator >
super_t::difference_type DGtal::ReverseIterator< Iterator >::distance_to ( ReverseIterator< OtherIterator > const &  y) const
inlineprivate

Definition at line 106 of file ReverseIterator.h.

107 {
108 return this->base_reference() - y.base();
109 }

◆ increment()

template<class Iterator >
void DGtal::ReverseIterator< Iterator >::increment ( )
inlineprivate

Definition at line 96 of file ReverseIterator.h.

96{ --this->base_reference(); }

Friends And Related Function Documentation

◆ boost::iterator_core_access

template<class Iterator >
friend class boost::iterator_core_access
friend

Definition at line 74 of file ReverseIterator.h.


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