]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/multi_array/test/reverse_view.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 // reverse_view.cpp - a small test of creating a view with negative strides
17 #include <boost/multi_array.hpp>
18 #include <boost/core/lightweight_test.hpp>
19 #include <boost/array.hpp>
24 using namespace boost
;
27 // One-dimensional array with views
28 double data
[] = { 1, 2, 3, 4 };
29 double rdata
[] = { 4, 3, 2, 1 };
31 typedef multi_array
< double, 1 > array
;
33 A
.assign(data
,data
+4);
35 typedef array::index_range range
;
36 array::array_view
<1>::type B
= A
[indices
[range(3, -1, -1)]];
38 for(multi_array_types::size_type i
= 0; i
!= B
.size(); ++i
) {
39 BOOST_TEST(B
[i
] == rdata
[i
]);
42 return boost::report_errors();