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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Class template local_buffer

boost::compute::local_buffer — Represents a local memory buffer on the device.


// In header: <boost/compute/memory/local_buffer.hpp>

template<typename T> 
class local_buffer {
  // construct/copy/destruct
  local_buffer(const size_t);
  local_buffer(const local_buffer &);
  local_buffer & operator=(const local_buffer &);

  // public member functions
  size_t size() const;


The local_buffer class represents a block of local memory on a compute device.

This class is most commonly used to set local memory arguments for compute kernels:

// set argument to a local buffer with storage for 32 float's
kernel.set_arg(0, local_buffer<float>(32));

See Also:

buffer, kernel

local_buffer public construct/copy/destruct

  1. local_buffer(const size_t size);
    Creates a local buffer object for size elements.
  2. local_buffer(const local_buffer & other);
    Creates a local buffer object as a copy of other.
  3. local_buffer & operator=(const local_buffer & other);
    Copies other to *this.
  4. ~local_buffer();
    Destroys the local memory object.

local_buffer public member functions

  1. size_t size() const;
    Returns the number of elements in the local buffer.