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 to view this page for the latest version.
PrevUpHomeNext

Class template constant_iterator

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

Synopsis

// 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;
};

Description

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

PrevUpHomeNext