basic1.cpp 771 B

12345678910111213141516171819202122232425
  1. // Copyright 2002 The Trustees of Indiana University.
  2. // Use, modification and distribution is subject to the Boost Software
  3. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Boost.MultiArray Library
  6. // Authors: Ronald Garcia
  7. // Jeremy Siek
  8. // Andrew Lumsdaine
  9. // See http://www.boost.org/libs/multi_array for documentation.
  10. #include <cassert>
  11. #include "boost/multi_array.hpp"
  12. #include "boost/cstdlib.hpp"
  13. int main () {
  14. // Create a 3D array that is 3 x 4 x 2
  15. typedef boost::multi_array<double, 3> array;
  16. array A(boost::extents[3][4][2]);
  17. // Assign a value to an element in the array
  18. A[0][0][0] = 3.14;
  19. assert(A[0][0][0] == 3.14);
  20. return boost::exit_success;
  21. }