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.

Chapter 27. Boost.MultiArray Reference Manual

Ronald Garcia

Indiana University
Open Systems Lab

Table of Contents

Library Synopsis
MultiArray Concept
Associated Types
Valid expressions
Complexity guarantees
Associated Types for Views
Array Components
Auxiliary Components
Global Objects
View and SubArray Generators
Memory Layout Specifiers
Range Checking

Boost.MultiArray is composed of several components. The MultiArray concept defines a generic interface to multidimensional containers. multi_array is a general purpose container class that models MultiArray. multi_array_ref and const_multi_array_ref are adapter classes. Using them, you can manipulate any block of contiguous data as though it were a multi_array. const_multi_array_ref differs from multi_array_ref in that its elements cannot be modified through its interface. Finally, several auxiliary classes are used to create and specialize arrays and some global objects are defined as part of the library interface.

Library Synopsis

To use Boost.MultiArray, you must include the header boost/multi_array.hpp in your source. This file brings the following declarations into scope:

namespace boost {
  namespace multi_array_types {
    typedef *unspecified* index;
    typedef *unspecified* size_type;
    typedef *unspecified* difference_type;
    typedef *unspecified* index_range;
    typedef *unspecified* extent_range;
    typedef *unspecified* index_gen;
    typedef *unspecified* extent_gen;

  template <typename ValueType, 
            std::size_t NumDims, 
            typename Allocator = std::allocator<ValueType> >
  class multi_array;

  template <typename ValueType, 
            std::size_t NumDims>
  class multi_array_ref;

  template <typename ValueType, 
            std::size_t NumDims> 
  class const_multi_array_ref;

  multi_array_types::extent_gen extents;
  multi_array_types::index_gen  indices;

  template <typename Array, int N> class subarray_gen;
  template <typename Array, int N> class const_subarray_gen;
  template <typename Array, int N> class array_view_gen;
  template <typename Array, int N> class const_array_view_gen;

  class c_storage_order; 
  class fortran_storage_order;
  template <std::size_t NumDims> class general_storage_order;