| Home | Libraries | People | FAQ | More

## Class template array

boost::compute::array — A fixed-size container.

## Synopsis

    // In header: <boost/compute/container/array.hpp>

    template<typename T, std::size_t N>
    class array {
    public:
      // types
      typedef T                                       value_type;
      typedef std::size_t                             size_type;
      typedef ptrdiff_t                               difference_type;
      typedef unspecified                             reference;
      typedef unspecified                             const_reference;
      typedef T *                                     pointer;
      typedef const T *                               const_pointer;
      typedef buffer_iterator< T >                    iterator;
      typedef buffer_iterator< T >                    const_iterator;
      typedef std::reverse_iterator< iterator >       reverse_iterator;
      typedef std::reverse_iterator< const_iterator > const_reverse_iterator;

      enum { static_size = N };

      // public member functions
      explicit array(const context & = system::default_context());
      array(const array< T, N > &);
      array(const boost::array< T, N > &,
            const context & = system::default_context());
      array(const array< T, N > &, const command_queue &);
      array< T, N > & operator=(const array< T, N > &);
      array< T, N > & operator=(const boost::array< T, N > &);
      ~array();
      iterator begin();
      const_iterator begin() const;
      const_iterator cbegin() const;
      iterator end();
      const_iterator end() const;
      const_iterator cend() const;
      reverse_iterator rbegin();
      const_reverse_iterator rbegin() const;
      const_reverse_iterator crbegin() const;
      reverse_iterator rend();
      const_reverse_iterator rend() const;
      const_reverse_iterator crend() const;
      size_type size() const;
      bool empty() const;
      size_type max_size() const;
      reference operator[](size_type);
      const_reference operator[](size_type) const;
      reference at(size_type);
      const_reference at(size_type) const;
      reference front();
      const_reference front() const;
      reference back();
      const_reference back() const;
      void fill(const value_type &, const command_queue &);
      void swap(array< T, N > &, const command_queue &);
      void fill(const value_type &);
      void swap(array< T, N > &);
      const buffer & get_buffer() const;

      // private member functions
      command_queue default_queue() const;
    };

## Description

The array container is very similar to the vector container except its size is fixed at compile-time rather than being dynamically resizable at run-time.

For example, to create a fixed-size array with eight values on the device:

    boost::compute::array<int, 8> values(context);

The Boost.Compute `array` class provides a STL-like API and is modeled after the `std::array` class from the C++ standard library.

See Also: vector<T>

### `array` public member functions

1.     explicit array(const context & context = system::default_context());

2.     array(const array< T, N > & other);

3.     array(const boost::array< T, N > & array,
             const context & context = system::default_context());

4.     array(const array< T, N > & other, const command_queue & queue);

5.     array< T, N > & operator=(const array< T, N > & other);

6.     array< T, N > & operator=(const boost::array< T, N > & array);

7.     ~array();

8.     iterator begin();

9.     const_iterator begin() const;

10.     const_iterator cbegin() const;

11.     iterator end();

12.     const_iterator end() const;

13.     const_iterator cend() const;

14.     reverse_iterator rbegin();

15.     const_reverse_iterator rbegin() const;

16.     const_reverse_iterator crbegin() const;

17.     reverse_iterator rend();

18.     const_reverse_iterator rend() const;

19.     const_reverse_iterator crend() const;

20.     size_type size() const;

21.     bool empty() const;

22.     size_type max_size() const;

23.     reference operator[](size_type index);

24.     const_reference operator[](size_type index) const;

25.     reference at(size_type index);

26.     const_reference at(size_type index) const;

27.     reference front();

28.     const_reference front() const;

29.     reference back();

30.     const_reference back() const;

31.     void fill(const value_type & value, const command_queue & queue);

32.     void swap(array< T, N > & other, const command_queue & queue);

33.     void fill(const value_type & value);

34.     void swap(array< T, N > & other);

35.     const buffer & get_buffer() const;

### `array` private member functions

1.     command_queue default_queue() const;