]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/multi_array/test/stl_interaction.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 // stl_interaction.cpp - Make sure multi_arrays work with STL containers.
17 #include <boost/core/lightweight_test.hpp>
19 #include <boost/multi_array.hpp>
28 typedef boost::multi_array_types::index_range range
;
29 typedef boost::multi_array
<int,3> array3
;
30 typedef boost::multi_array
<int,2> array2
;
32 typedef std::vector
<array3
> array3vec
;
43 const int data_size
= 24;
49 const int insert_size
= 4;
50 array3
myarray(extents
[2][3][4]);
51 myarray
.assign(data
,data
+data_size
);
53 array3vec
myvec(5,myarray
);
54 BOOST_TEST(myarray
== myvec
[1]);
56 array3::array_view
<2>::type myview
=
57 myarray
[indices
[1][range(0,2)][range(1,3)]];
59 array2
filler(extents
[2][2]);
60 filler
.assign(insert
,insert
+insert_size
);
62 // Modify a portion of myarray through a view (myview)
66 myvec
.push_back(myarray
);
68 BOOST_TEST(myarray
!= myvec
[1]);
69 BOOST_TEST(myarray
== myvec
[5]);
71 return boost::report_errors();