sl@0: /* simple 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: #ifdef __SYMBIAN32__ sl@0: #include "std_log_result.h" sl@0: #define LOG_FILENAME_LINE __FILE__, __LINE__ sl@0: #endif sl@0: sl@0: template sl@0: void test_static_size (const T& cont) sl@0: { sl@0: int tmp[T::static_size]; sl@0: for (unsigned i=0; i Array; sl@0: sl@0: // create and initialize an array sl@0: const Array a = { { 42.42 } }; sl@0: sl@0: // use some common STL container operations sl@0: std::cout << "static_size: " << a.size() << std::endl; sl@0: std::cout << "size: " << a.size() << std::endl; sl@0: // Can't use std::boolalpha because it isn't portable sl@0: std::cout << "empty: " << (a.empty()? "true" : "false") << std::endl; sl@0: std::cout << "max_size: " << a.max_size() << std::endl; sl@0: std::cout << "front: " << a.front() << std::endl; sl@0: std::cout << "back: " << a.back() << std::endl; sl@0: std::cout << "[0]: " << a[0] << std::endl; sl@0: std::cout << "elems: "; sl@0: sl@0: // iterate through all elements sl@0: for (Array::const_iterator pos=a.begin(); pos DArray; sl@0: typedef boost::array IArray; sl@0: IArray ia = { { 1, 2, 3, 4, 5, 6 } } ; // extra braces silence GCC warning sl@0: DArray da; sl@0: da = ia; sl@0: da.assign(42); sl@0: #ifdef __SYMBIAN32__ sl@0: testResultXml("array5"); sl@0: close_log_file(); sl@0: #endif sl@0: sl@0: return 0; // makes Visual-C++ compiler happy sl@0: } sl@0: