...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::buffer_iterator — An iterator for values in a buffer.
// 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 &); };
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/destructbuffer_iterator();
buffer_iterator(const buffer & buffer, size_t index);
buffer_iterator(const buffer_iterator< T > & other);
buffer_iterator< T > & operator=(const buffer_iterator< T > & other);
~buffer_iterator();