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 buffer_iterator

boost::compute::buffer_iterator — An iterator for values in a buffer.

Synopsis

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

template<typename T> 
class buffer_iterator {
public:
  // types
  typedef unspecified                 super_type;     
  typedef super_type::reference       reference;      
  typedef super_type::difference_type difference_type;

  // construct/copy/destruct
  buffer_iterator();
  buffer_iterator(const buffer &, size_t);
  buffer_iterator(const buffer_iterator< T > &);
  buffer_iterator< T > & operator=(const buffer_iterator< T > &);
  ~buffer_iterator();

  // public member functions
  const buffer & get_buffer() const;
  size_t get_index() const;
  T read(command_queue &) const;
  void write(const T &, command_queue &);
};

Description

The buffer_iterator class iterates over values in a memory buffer on a compute device. It is the most commonly used iterator in Boost.Compute and is used by the vector<T> and array<T, N> container classes.

Buffer iterators store a reference to a memory buffer along with an index into that memory buffer.

The buffer_iterator class allows for arbitrary OpenCL memory objects (including those created outside of Boost.Compute) to be used with the Boost.Compute algorithms (such as transform() and sort()). For example, to reverse the contents of an OpenCL memory buffer containing a set of integers:


See Also:

buffer, make_buffer_iterator()

buffer_iterator public construct/copy/destruct

  1. buffer_iterator();
  2. buffer_iterator(const buffer & buffer, size_t index);
  3. buffer_iterator(const buffer_iterator< T > & other);
  4. buffer_iterator< T > & operator=(const buffer_iterator< T > & other);
  5. ~buffer_iterator();

buffer_iterator public member functions

  1. const buffer & get_buffer() const;
  2. size_t get_index() const;
  3. T read(command_queue & queue) const;
  4. void write(const T & value, command_queue & queue);

PrevUpHomeNext