1 #ifndef CLASSIC_SliceIterator_HH
2 #define CLASSIC_SliceIterator_HH
179 inline std::random_access_iterator_tag
181 return std::random_access_iterator_tag();
185 inline std::random_access_iterator_tag
187 return std::random_access_iterator_tag();
206 cursor(array), stride(
n)
211 cursor(rhs.cursor), stride(rhs.stride)
224 return cursor == rhs.
cursor;
229 return cursor != rhs.
cursor;
260 cursor +=
n * stride;
266 cursor -=
n * stride;
285 return (cursor - rhs.
cursor) / stride;
295 return cursor[
n*stride];
304 (
const T *array, std::ptrdiff_t
n):
305 cursor(array), stride(
n)
311 cursor(rhs.cursor), stride(rhs.stride)
325 return cursor == rhs.
cursor;
331 return cursor != rhs.
cursor;
363 cursor +=
n * stride;
370 cursor -=
n * stride;
374 template<
class T>
inline
380 template<
class T>
inline
389 return (cursor - rhs.
cursor) / stride;
399 return cursor[
n*stride];
T * value_type(const SliceIterator< T > &)
std::random_access_iterator_tag iterator_category(const SliceIterator< T > &)
Iterator for array slice.
bool operator!=(const SliceIterator< T > &rhs) const
SliceIterator< T > & operator++()
Increment (iterate forward).
T * pointer
The pointer type.
SliceIterator< T > operator+(std::ptrdiff_t)
Add multiple stride.
std::ptrdiff_t difference_type
The pointer difference type.
bool operator==(const SliceIterator< T > &rhs) const
T & operator[](int) const
Delegate.
SliceIterator< T > & operator+=(std::ptrdiff_t)
Increment by multiple stride.
std::random_access_iterator_tag iterator_category
The iterator tag, taken from the standard template library.
SliceIterator< T > operator-(std::ptrdiff_t)
Subtract multiple stride.
SliceIterator< T > & operator--()
Decrement (iterate backward).
T & reference
The reference type.
T & operator*() const
Dereference.
SliceIterator< T > & operator-=(std::ptrdiff_t)
Decrement by multiple stride.
SliceIterator< T > & operator=(const SliceIterator< T > &)
SliceIterator(T *array, std::ptrdiff_t stride)
Constructor.
T value_type
The value type.
Iterator for array slice.
ConstSliceIterator< T > & operator++()
Increment (iterate forward).
const T & reference
The reference type.
ConstSliceIterator< T > & operator=(const ConstSliceIterator< T > &)
const T & operator*() const
Dereference.
const T value_type
The value type.
bool operator==(const ConstSliceIterator< T > &rhs) const
ConstSliceIterator< T > & operator+=(std::ptrdiff_t)
Add multiple stride and assign.
bool operator!=(const ConstSliceIterator< T > &rhs) const
std::random_access_iterator_tag iterator_category
The iterator tag, taken from the standard template library.
const T * pointer
The pointer type.
ConstSliceIterator< T > operator+(std::ptrdiff_t) const
Add multiple stride.
ConstSliceIterator< T > operator-(std::ptrdiff_t) const
Subtract multiple stride.
ConstSliceIterator< T > & operator-=(std::ptrdiff_t)
Subtract multiple stride and assign.
ConstSliceIterator< T > & operator--()
Decrement (iterate backward).
const T & operator[](int) const
Delegate.
ConstSliceIterator(const T *array, std::ptrdiff_t stride)
Constructor.
std::ptrdiff_t difference_type
The pointer difference type.