1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/stdcpp/tsrc/Boost_test/array/inc/print.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,27 @@
1.4 +/* The following code example is taken from the book
1.5 + * "The C++ Standard Library - A Tutorial and Reference"
1.6 + * by Nicolai M. Josuttis, Addison-Wesley, 1999
1.7 + *
1.8 + * (C) Copyright Nicolai M. Josuttis 1999.
1.9 + * Distributed under the Boost Software License, Version 1.0. (See
1.10 + * accompanying file LICENSE_1_0.txt or copy at
1.11 + * http://www.boost.org/LICENSE_1_0.txt)
1.12 + */
1.13 +#include <iostream>
1.14 +
1.15 +/* print_elements()
1.16 + * - prints optional C-string optcstr followed by
1.17 + * - all elements of the collection coll
1.18 + * - separated by spaces
1.19 + */
1.20 +template <class T>
1.21 +inline void print_elements (const T& coll, const char* optcstr="")
1.22 +{
1.23 + typename T::const_iterator pos;
1.24 +
1.25 + std::cout << optcstr;
1.26 + for (pos=coll.begin(); pos!=coll.end(); ++pos) {
1.27 + std::cout << *pos << ' ';
1.28 + }
1.29 + std::cout << std::endl;
1.30 +}