Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Function template make_strided_iterator

boost::compute::make_strided_iterator

Synopsis

// In header: <boost/compute/iterator/strided_iterator.hpp>


template<typename Iterator> 
  strided_iterator< Iterator > 
  make_strided_iterator(Iterator iterator, 
                        typename std::iterator_traits< Iterator >::difference_type stride);

Description

Returns a strided_iterator for iterator with stride.

For example, to create an iterator which iterates over every other element in a vector<int>:

auto strided_iterator = make_strided_iterator(vec.begin(), 2);

Parameters:

iterator

the underlying iterator

stride

the iteration step for strided_iterator

Returns:

a strided_iterator for iterator with stride.


PrevUpHomeNext