DGtal  1.5.beta
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 >:
[legend]

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 69 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 73 of file ReverseIterator.h.

◆ Type

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

Definition at line 79 of file ReverseIterator.h.

Constructor & Destructor Documentation

◆ ReverseIterator() [1/3]

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

Definition at line 81 of file ReverseIterator.h.

81 {}

◆ ReverseIterator() [2/3]

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

Definition at line 83 of file ReverseIterator.h.

84  : 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 87 of file ReverseIterator.h.

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

Member Function Documentation

◆ advance()

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

Definition at line 100 of file ReverseIterator.h.

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

◆ decrement()

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

Definition at line 98 of file ReverseIterator.h.

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

◆ dereference()

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

Definition at line 95 of file ReverseIterator.h.

95 { 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 107 of file ReverseIterator.h.

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

◆ increment()

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

Definition at line 97 of file ReverseIterator.h.

97 { --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 75 of file ReverseIterator.h.


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