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/next_prior.hpp>
49 #include <boost/iterator/iterator_adaptor.hpp>
68 template <
class Iterator>
70 :
public boost::iterator_adaptor< ReverseIterator<Iterator>, Iterator >
73 typedef boost::iterator_adaptor< ReverseIterator<Iterator>, Iterator >
super_t;
86 template<
class OtherIterator>
89 ,
typename boost::enable_if_convertible<OtherIterator, Iterator>::type* = 0
95 typename super_t::reference
dereference()
const {
return *boost::prior(this->base()); }
100 void advance(
typename super_t::difference_type n)
102 this->base_reference() += -n;
105 template <
class OtherIterator>
106 typename super_t::difference_type
109 return this->base_reference() - y.base();
125 #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.