Update contrib.
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 * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
15 #include <boost/array.hpp>
18 #include "std_log_result.h"
19 #define LOG_FILENAME_LINE __FILE__, __LINE__
23 std_log(LOG_FILENAME_LINE,"[Test Case for array4]");
24 // array of arrays of seasons
25 boost::array<boost::array<std::string,4>,2> seasons_i18n = {
26 { { { "spring", "summer", "autumn", "winter", } },
27 { { "Fruehling", "Sommer", "Herbst", "Winter" } }
31 // for any array of seasons print seasons
32 for (unsigned i=0; i<seasons_i18n.size(); ++i) {
33 boost::array<std::string,4> seasons = seasons_i18n[i];
34 for (unsigned j=0; j<seasons.size(); ++j) {
35 std::cout << seasons[j] << " ";
37 std::cout << std::endl;
40 // print first element of first array
41 std::cout << "first element of first array: "
42 << seasons_i18n[0][0] << std::endl;
44 // print last element of last array
45 std::cout << "last element of last array: "
46 << seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1]
48 if(seasons_i18n[0][0]!= "spring" && seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1] != "Winter")
50 std_log(LOG_FILENAME_LINE,"Result : Failed");
54 std_log(LOG_FILENAME_LINE,"Result : Passed");
56 testResultXml("array4");
60 return 0; // makes Visual-C++ compiler happy