Boost C++ Libraries

...one 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 a snapshot of the master branch, built from commit 7789ef3d8d.
PrevUpHomeNext

Class template extents

boost::compute::extents

Synopsis

// In header: <boost/compute/utility/extents.hpp>

template<size_t N> 
class extents {
public:
  // types
  typedef size_t                     size_type;     
  typedef boost::array< size_t, N >  array_type;    
  typedef array_type::iterator       iterator;      
  typedef array_type::const_iterator const_iterator;

  // construct/copy/destruct
  extents();
  explicit extents(size_t);
  extents(std::initializer_list< size_t >);

  // public member functions
  size_type size() const;
  size_type linear() const;
  size_t * data();
  const size_t * data() const;
  iterator begin();
  const_iterator begin() const;
  const_iterator cbegin() const;
  iterator end();
  const_iterator end() const;
  const_iterator cend() const;
  size_t & operator[](size_t);
  const size_t & operator[](size_t) const;
  bool operator==(const extents &) const;
  bool operator!=(const extents &) const;

  // public data members
  static const size_type static_size;
};

Description

The extents class contains an array of n-dimensional extents.

See Also:

dim()

extents public construct/copy/destruct

  1. extents();

    Creates an extents object with each component set to zero.

    For example:

    extents<3> exts(); // (0, 0, 0)
    

  2. explicit extents(size_t value);

    Creates an extents object with each component set to value.

    For example:

    extents<3> exts(1); // (1, 1, 1)
    

  3. extents(std::initializer_list< size_t > values);
    Creates an extents object with values.

extents public member functions

  1. size_type size() const;
    Returns the size (i.e. dimensionality) of the extents array.
  2. size_type linear() const;

    Returns the linear size of the extents. This is equivalent to the product of each extent in each dimension.

  3. size_t * data();

    Returns a pointer to the extents data array.

    This is useful for passing the extents data to OpenCL APIs which expect an array of size_t.

  4. const size_t * data() const;
    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
  5. iterator begin();
  6. const_iterator begin() const;
  7. const_iterator cbegin() const;
  8. iterator end();
  9. const_iterator end() const;
  10. const_iterator cend() const;
  11. size_t & operator[](size_t index);
    Returns a reference to the extent at index.
  12. const size_t & operator[](size_t index) const;
    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
  13. bool operator==(const extents & other) const;
    Returns true if the extents in *this are the same as other.
  14. bool operator!=(const extents & other) const;
    Returns true if the extents in *this are not the same as other.

PrevUpHomeNext