31#if defined(ReverseIterator_RECURSES)
32#error Recursive header files inclusion detected in ReverseIterator.h
35#define ReverseIterator_RECURSES
37#if !defined ReverseIterator_h
39#define ReverseIterator_h
44#include "DGtal/base/Common.h"
45#include "DGtal/base/IteratorCirculatorTraits.h"
46#include <boost/iterator.hpp>
47#include <boost/utility.hpp>
48#include <boost/iterator/iterator_adaptor.hpp>
67 template <
class Iterator>
69 :
public boost::iterator_adaptor< ReverseIterator<Iterator>, Iterator >
72 typedef boost::iterator_adaptor< ReverseIterator<Iterator>, Iterator >
super_t;
85 template<
class OtherIterator>
88 ,
typename boost::enable_if_convertible<OtherIterator, Iterator>::type* = 0
94 typename super_t::reference
dereference()
const {
return *boost::prior(this->base()); }
99 void advance(
typename super_t::difference_type n)
101 this->base_reference() += -n;
104 template <
class OtherIterator>
105 typename super_t::difference_type
108 return this->base_reference() - y.base();
124#undef ReverseIterator_RECURSES
This class adapts any bidirectional iterator so that operator++ calls operator-- and vice versa.
ReverseIterator(ReverseIterator< OtherIterator > const &r, typename boost::enable_if_convertible< OtherIterator, Iterator >::type *=0)
super_t::reference dereference() const
ReverseIterator(Iterator x)
IteratorCirculatorTraits< Iterator >::Type Type
void advance(typename super_t::difference_type n)
friend class boost::iterator_core_access
boost::iterator_adaptor< ReverseIterator< Iterator >, Iterator > super_t
super_t::difference_type distance_to(ReverseIterator< OtherIterator > const &y) const
DGtal is the top-level namespace which contains all DGtal functions and types.