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


Class template constant_iterator

boost::compute::constant_iterator — An iterator with a constant value.


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

template<typename T> 
class constant_iterator {
  // 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 > &);

  // 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:


constant_iterator public construct/copy/destruct

  1. constant_iterator(const T & value, size_t index = 0);
  2. constant_iterator(const constant_iterator< T > & other);
  3. constant_iterator< T > & operator=(const constant_iterator< T > & other);
  4. ~constant_iterator();

constant_iterator public member functions

  1. size_t get_index() const;