![]() |
Home | Libraries | People | FAQ | More |
boost::compute::counting_iterator — The counting_iterator class implements a counting iterator.
// In header: <boost/compute/iterator/counting_iterator.hpp> template<typename T> class counting_iterator { public: // types typedef unspecified super_type; typedef super_type::reference reference; typedef super_type::difference_type difference_type; // public member functions counting_iterator(const T &); counting_iterator(const counting_iterator< T > &); counting_iterator< T > & operator=(const counting_iterator< T > &); ~counting_iterator(); size_t get_index() const; template<typename Expr> unspecified operator[](const Expr &) const; // private member functions reference dereference() const; bool equal(const counting_iterator< T > &) const; void increment(); void decrement(); void advance(difference_type); difference_type distance_to(const counting_iterator< T > &) const; };
A counting iterator returns an internal value (initialized with init) which is incremented each time the iterator is incremented.
For example, this could be used to implement the iota() algorithm in terms of the copy() algorithm by copying from a range of counting iterators:
See Also: make_counting_iterator()
counting_iterator public member functionscounting_iterator(const T & init);
counting_iterator(const counting_iterator< T > & other);
counting_iterator< T > & operator=(const counting_iterator< T > & other);
~counting_iterator();
size_t get_index() const;
template<typename Expr> unspecified operator[](const Expr & expr) const;
counting_iterator private member functionsreference dereference() const;
bool equal(const counting_iterator< T > & other) const;
void increment();
void decrement();
void advance(difference_type n);
difference_type distance_to(const counting_iterator< T > & other) const;