| Home | Libraries | People | FAQ | More

## Class template buffer_allocator

boost::compute::buffer_allocator — The buffer_allocator class allocates memory with buffer objects.

## Synopsis

    // In header: <boost/compute/allocator/buffer_allocator.hpp>

    template<typename T>
    class buffer_allocator {
    public:
      // types
      typedef T              value_type;
      typedef unspecified    pointer;
      typedef unspecified    const_pointer;
      typedef std::size_t    size_type;
      typedef std::ptrdiff_t difference_type;

      // construct/copy/destruct
      explicit buffer_allocator(const context &);
      buffer_allocator(const buffer_allocator< T > &);
      buffer_allocator(buffer_allocator< T > &&) noexcept;
      buffer_allocator< T > & operator=(const buffer_allocator< T > &);
      buffer_allocator< T > & operator=(buffer_allocator< T > &&) noexcept;
      ~buffer_allocator();

      // public member functions
      pointer allocate(size_type);
      void deallocate(pointer, size_type);
      size_type max_size() const;
      context get_context() const;

      // protected member functions
      void set_mem_flags(cl_mem_flags);
    };

## Description

See Also:

buffer

### `buffer_allocator` public construct/copy/destruct

1.     explicit buffer_allocator(const context & context);

2.     buffer_allocator(const buffer_allocator< T > & other);

3.     buffer_allocator(buffer_allocator< T > && other) noexcept;

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

5.     buffer_allocator< T > & operator=(buffer_allocator< T > && other) noexcept;

6.     ~buffer_allocator();

### `buffer_allocator` public member functions

1.     pointer allocate(size_type n);

2.     void deallocate(pointer p, size_type n);

3.     size_type max_size() const;

4.     context get_context() const;

### `buffer_allocator` protected member functions

1.     void set_mem_flags(cl_mem_flags flags);