]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/multi_array/example/foreach_test.cpp
1 // Copyright 2002 The Trustees of Indiana University.
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)
7 // Boost.MultiArray Library
8 // Authors: Ronald Garcia
11 // See http://www.boost.org/libs/multi_array for documentation.
14 // Let's see if this stuff works
16 #include "boost/multi_array.hpp"
17 #include "for_each.hpp"
21 double operator()(const int& val
) { return val
*5.0; }
27 typedef boost::multi_array
<double,2> array
;
34 const int data_size
=9;
36 array
A(boost::extents
[3][3]);
37 A
.assign(data
,data
+data_size
);
40 std::copy(A
.data(),A
.data()+A
.num_elements(),
41 std::ostream_iterator
<double>(std::cout
,","));
45 for_each(A
,times_five());
48 std::copy(A
.data(),A
.data()+A
.num_elements(),
49 std::ostream_iterator
<double>(std::cout
,","));