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