1 #ifndef CORE_ConstantStrideIterator_HPP
2 #define CORE_ConstantStrideIterator_HPP
11 template<
class Ptr_Type, tInt Step>
18 typedef typename std::iterator_traits<Ptr_Type>::value_type
value_type;
21 typedef typename std::iterator_traits<Ptr_Type>::reference
reference;
24 typedef typename std::iterator_traits<Ptr_Type>::pointer
pointer;
100 self operator++(
int s) {
self tmp = *
this; mPointer += Step;
return tmp; }
109 self operator--(
int s) {
self tmp = *
this; mPointer -= Step;
return tmp; }
137 return (x.mPointer - y.mPointer) / Step;
151 return x.mPointer == y.mPointer;
159 return x.mPointer != y.mPointer;
167 return x.mPointer < y.mPointer;
this class describes a const iterator with a constant stride
Definition: CORE_ConstantStrideIterator.h:12
std::iterator_traits< Ptr_Type >::reference reference
reference value type
Definition: CORE_ConstantStrideIterator.h:21
self operator++(int s)
return the current element and set the iterator to s next element
Definition: CORE_ConstantStrideIterator.h:100
friend bool operator==(self x, self y)
compare the 2 iterator if equal
Definition: CORE_ConstantStrideIterator.h:149
std::iterator_traits< Ptr_Type >::value_type value_type
copy value type
Definition: CORE_ConstantStrideIterator.h:18
self operator--(int s)
return the current element and set the iterator to previous element
Definition: CORE_ConstantStrideIterator.h:109
self & operator+=(difference_type x)
move the iterator on x elements
Definition: CORE_ConstantStrideIterator.h:85
friend difference_type operator-(self x, self y)
return the number of difference elements number between 2 iterators
Definition: CORE_ConstantStrideIterator.h:136
self & operator--()
return the previous element and set the iterator to previous element
Definition: CORE_ConstantStrideIterator.h:104
self & operator++()
return the next element and set the iterator to next element
Definition: CORE_ConstantStrideIterator.h:95
virtual ~CORE_ConstantStrideIterator()
destructor of class
Definition: CORE_ConstantStrideIterator.h:63
std::iterator_traits< Ptr_Type >::difference_type difference_type
displacement type
Definition: CORE_ConstantStrideIterator.h:28
friend self operator+(difference_type x, self y)
add x elements to y iterator : y:=y+x
Definition: CORE_ConstantStrideIterator.h:129
CORE_ConstantStrideIterator()
default constructor
Definition: CORE_ConstantStrideIterator.h:49
friend self operator+(self x, difference_type y)
add y element to x iterator : x:=x+y
Definition: CORE_ConstantStrideIterator.h:121
CORE_ConstantStrideIterator(Ptr_Type x)
initializer constructor
Definition: CORE_ConstantStrideIterator.h:54
CORE_ConstantStrideIterator(const self &x)
copy constructor
Definition: CORE_ConstantStrideIterator.h:59
const reference operator[](difference_type n)
access to n-th element of the list
Definition: CORE_ConstantStrideIterator.h:76
friend bool operator<(self x, self y)
compare the 2 iterators on same values
Definition: CORE_ConstantStrideIterator.h:165
const reference operator*()
return the pointer of the iterator
Definition: CORE_ConstantStrideIterator.h:71
std::iterator_traits< Ptr_Type >::pointer pointer
pointer value type
Definition: CORE_ConstantStrideIterator.h:24
friend bool operator!=(self x, self y)
compare the 2 iterator if not equal
Definition: CORE_ConstantStrideIterator.h:157
std::random_access_iterator_tag iterator_category
type of iterator
Definition: CORE_ConstantStrideIterator.h:31