...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::constant_iterator — An iterator with a constant value.
// In header: <boost/compute/iterator/constant_iterator.hpp> template<typename T> class constant_iterator { public: // types typedef unspecified super_type; typedef super_type::reference reference; typedef super_type::difference_type difference_type; // construct/copy/destruct constant_iterator(const T &, size_t = 0); constant_iterator(const constant_iterator< T > &); constant_iterator< T > & operator=(const constant_iterator< T > &); ~constant_iterator(); // public member functions size_t get_index() const; };
The constant_iterator class provides an iterator which returns a constant value when dereferenced.
For example, this could be used to implement the fill() algorithm in terms of the copy() algorithm by copying from a range of constant iterators:
See Also:
make_constant_iterator()
constant_iterator
public
construct/copy/destructconstant_iterator(const T & value, size_t index = 0);
constant_iterator(const constant_iterator< T > & other);
constant_iterator< T > & operator=(const constant_iterator< T > & other);
~constant_iterator();