]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/array/test/array2.cpp
1 /* example for using class array<>
2 * (C) Copyright Nicolai M. Josuttis 2001.
3 * Distributed under the Boost Software License, Version 1.0. (See
4 * accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef _SCL_SECURE_NO_WARNINGS
9 // Suppress warnings from the std lib:
10 # define _SCL_SECURE_NO_WARNINGS
15 #include <boost/array.hpp>
21 // create and initialize array
22 boost::array
<int,10> a
= { { 1, 2, 3, 4, 5 } };
26 // modify elements directly
27 for (unsigned i
=0; i
<a
.size(); ++i
) {
32 // change order using an STL algorithm
33 reverse(a
.begin(),a
.end());
36 // negate elements using STL framework
37 transform(a
.begin(),a
.end(), // source
38 a
.begin(), // destination
39 negate
<int>()); // operation
42 return 0; // makes Visual-C++ compiler happy