1 #ifndef _theplu_yat_utility_stride_iterator_
2 #define _theplu_yat_utility_stride_iterator_
26 #include <boost/concept_check.hpp>
27 #include <boost/iterator/iterator_adaptor.hpp>
44 template<
typename RandomAccessIterator>
46 :
public boost::iterator_adaptor<StrideIterator<RandomAccessIterator>
47 , RandomAccessIterator
49 , typename std::iterator_traits<RandomAccessIterator>::iterator_category>
51 typedef boost::iterator_adaptor<StrideIterator<RandomAccessIterator>,
54 typename std::iterator_traits<RandomAccessIterator>::iterator_category>
69 BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<RandomAccessIterator>));
96 typename boost::enable_if_convertible<I2
97 , RandomAccessIterator>::type* = 0 )
107 this->base_reference() = rhs.base();
114 inline size_t stride(
void)
const {
return stride_; }
118 friend class boost::iterator_core_access;
123 typedef typename StrideIterator::iterator_adaptor_::difference_type
126 void advance(
typename super_t::difference_type n)
127 { this->base_reference() += stride_*n; }
129 void decrement(
void) { this->base_reference()-=stride_; }
131 template <
class OtherIterator>
132 typename super_t::difference_type
133 distance_to(
const StrideIterator<OtherIterator>& other)
const
136 return (other.base() - this->base() )/static_cast<int>(stride_);
139 void increment(
void) { this->base_reference()+=stride_; }