diff -r 000000000000 -r bde4ae8d615e os/ossrv/stdcpp/tsrc/Boost_test/array/src/array3.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/ossrv/stdcpp/tsrc/Boost_test/array/src/array3.cpp Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,84 @@ +/* example for using class array<> + * (C) Copyright Nicolai M. Josuttis 2001. + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ +/* + * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. +*/ + +#include +#include +#include + +#ifdef __SYMBIAN32__ +#include "std_log_result.h" +#define LOG_FILENAME_LINE __FILE__, __LINE__ +#endif +template +void print_elements (const T& x); + +int main() +{ +std_log(LOG_FILENAME_LINE,"[Test Case for array3]"); +int failures=0; + // create array of four seasons + boost::array seasons = { + { "spring", "summer", "autumn", "winter" } + }; + + // copy and change order + boost::array seasons_orig = seasons; + for (unsigned i=seasons.size()-1; i>0; --i) { + std::swap(seasons.at(i),seasons.at((i+1)%seasons.size())); + } + + std::cout << "one way: "; + print_elements(seasons); + + // try swap() + std::cout << "other way: "; + std::swap(seasons,seasons_orig); + print_elements(seasons); + + // try reverse iterators + std::cout << "reverse: "; + for (boost::array::reverse_iterator pos + =seasons.rbegin(); pos +void print_elements (const T& x) +{ + for (unsigned i=0; i