diff -r 000000000000 -r bde4ae8d615e os/ossrv/stdcpp/tsrc/Boost_test/array/inc/print.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/ossrv/stdcpp/tsrc/Boost_test/array/inc/print.hpp Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,27 @@ +/* The following code example is taken from the book + * "The C++ Standard Library - A Tutorial and Reference" + * by Nicolai M. Josuttis, Addison-Wesley, 1999 + * + * (C) Copyright Nicolai M. Josuttis 1999. + * 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) + */ +#include + +/* print_elements() + * - prints optional C-string optcstr followed by + * - all elements of the collection coll + * - separated by spaces + */ +template +inline void print_elements (const T& coll, const char* optcstr="") +{ + typename T::const_iterator pos; + + std::cout << optcstr; + for (pos=coll.begin(); pos!=coll.end(); ++pos) { + std::cout << *pos << ' '; + } + std::cout << std::endl; +}