]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/array/test/array4.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)
12 #include <boost/array.hpp>
16 // array of arrays of seasons
17 boost::array
<boost::array
<std::string
,4>,2> seasons_i18n
= {
18 { { { "spring", "summer", "autumn", "winter", } },
19 { { "Fruehling", "Sommer", "Herbst", "Winter" } }
23 // for any array of seasons print seasons
24 for (unsigned i
=0; i
<seasons_i18n
.size(); ++i
) {
25 boost::array
<std::string
,4> seasons
= seasons_i18n
[i
];
26 for (unsigned j
=0; j
<seasons
.size(); ++j
) {
27 std::cout
<< seasons
[j
] << " ";
29 std::cout
<< std::endl
;
32 // print first element of first array
33 std::cout
<< "first element of first array: "
34 << seasons_i18n
[0][0] << std::endl
;
36 // print last element of last array
37 std::cout
<< "last element of last array: "
38 << seasons_i18n
[seasons_i18n
.size()-1][seasons_i18n
[0].size()-1]
41 return 0; // makes Visual-C++ compiler happy