sl@0: /* example for using class array<> sl@0: * (C) Copyright Nicolai M. Josuttis 2001. sl@0: * Distributed under the Boost Software License, Version 1.0. (See sl@0: * accompanying file LICENSE_1_0.txt or copy at sl@0: * http://www.boost.org/LICENSE_1_0.txt) sl@0: */ sl@0: /* sl@0: * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. sl@0: */ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: #include "std_log_result.h" sl@0: #define LOG_FILENAME_LINE __FILE__, __LINE__ sl@0: #endif sl@0: template sl@0: void print_elements (const T& x); sl@0: sl@0: int main() sl@0: { sl@0: std_log(LOG_FILENAME_LINE,"[Test Case for array3]"); sl@0: int failures=0; sl@0: // create array of four seasons sl@0: boost::array seasons = { sl@0: { "spring", "summer", "autumn", "winter" } sl@0: }; sl@0: sl@0: // copy and change order sl@0: boost::array seasons_orig = seasons; sl@0: for (unsigned i=seasons.size()-1; i>0; --i) { sl@0: std::swap(seasons.at(i),seasons.at((i+1)%seasons.size())); sl@0: } sl@0: sl@0: std::cout << "one way: "; sl@0: print_elements(seasons); sl@0: sl@0: // try swap() sl@0: std::cout << "other way: "; sl@0: std::swap(seasons,seasons_orig); sl@0: print_elements(seasons); sl@0: sl@0: // try reverse iterators sl@0: std::cout << "reverse: "; sl@0: for (boost::array::reverse_iterator pos sl@0: =seasons.rbegin(); pos sl@0: void print_elements (const T& x) sl@0: { sl@0: for (unsigned i=0; i