sl@0: /* The following code example is taken from the book
sl@0:  * "The C++ Standard Library - A Tutorial and Reference"
sl@0:  * by Nicolai M. Josuttis, Addison-Wesley, 1999
sl@0:  *
sl@0:  * (C) Copyright Nicolai M. Josuttis 1999.
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: #include <iostream>
sl@0: 
sl@0: /* print_elements()
sl@0:  * - prints optional C-string optcstr followed by
sl@0:  * - all elements of the collection coll
sl@0:  * - separated by spaces
sl@0:  */
sl@0: template <class T>
sl@0: inline void print_elements (const T& coll, const char* optcstr="")
sl@0: {
sl@0:     typename T::const_iterator pos;
sl@0: 
sl@0:     std::cout << optcstr;
sl@0:     for (pos=coll.begin(); pos!=coll.end(); ++pos) {
sl@0:         std::cout << *pos << ' ';
sl@0:     }
sl@0:     std::cout << std::endl;
sl@0: }