...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::compute::make_strided_iterator_end
// In header: <boost/compute/iterator/strided_iterator.hpp> template<typename Iterator> strided_iterator< Iterator > make_strided_iterator_end(Iterator first, Iterator last, typename std::iterator_traits< Iterator >::difference_type stride);
Returns a strided_iterator
which refers to element that would follow the last element accessible through strided_iterator
for first
iterator with stride
.
Parameter stride
must be greater than zero.
It can be helpful when iterating over strided_iterator
:
// vec.size() may not be divisible by 3 auto strided_iterator_begin = make_strided_iterator(vec.begin(), 3); auto strided_iterator_end = make_strided_iterator_end(vec.begin(), vec.end(), 3); // copy every 3rd element to result boost::compute::copy( strided_iterator_begin, strided_iterator_end, result.begin(), queue );
Parameters: |
|
||||||
Returns: |
a |