| Home | Libraries | People | FAQ | More

## Class template constant_buffer_iterator

boost::compute::constant_buffer_iterator — An iterator for a buffer in the `constant` memory space.

## Synopsis

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

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

      // construct/copy/destruct
      constant_buffer_iterator();
      constant_buffer_iterator(const buffer &, size_t);
      constant_buffer_iterator(const constant_buffer_iterator< T > &);
      constant_buffer_iterator< T > &
      operator=(const constant_buffer_iterator< T > &);
      ~constant_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 &);
      template<typename Expr> unspecified operator[](const Expr &) const;

      // private member functions
      reference dereference() const;
      bool equal(const constant_buffer_iterator< T > &) const;
      void increment();
      void decrement();
      void advance(difference_type);
      difference_type distance_to(const constant_buffer_iterator< T > &) const;
    };

## Description

The constant_buffer_iterator class provides an iterator for values in a buffer in the `constant` memory space.

For iterating over values in the `global` memory space (the most common case), use the buffer_iterator class.

See Also:

buffer_iterator

### `constant_buffer_iterator` public construct/copy/destruct

1.     constant_buffer_iterator();

2.     constant_buffer_iterator(const buffer & buffer, size_t index);

3.     constant_buffer_iterator(const constant_buffer_iterator< T > & other);

4.     constant_buffer_iterator< T > &
       operator=(const constant_buffer_iterator< T > & other);

5.     ~constant_buffer_iterator();

### `constant_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);

5.     template<typename Expr> unspecified operator[](const Expr & expr) const;

### `constant_buffer_iterator` private member functions

1.     reference dereference() const;

2.     bool equal(const constant_buffer_iterator< T > & other) const;

3.     void increment();

4.     void decrement();

5.     void advance(difference_type n);

6.     difference_type distance_to(const constant_buffer_iterator< T > & other) const;