mirror of
https://github.com/boostorg/array.git
synced 2025-07-12 20:26:35 +02:00
Changes reflecting formal review comments
[SVN r7689]
This commit is contained in:
28
print.hpp
Normal file
28
print.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
/* 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.
|
||||
* Permission to copy, use, modify, sell and distribute this software
|
||||
* is granted provided this copyright notice appears in all copies.
|
||||
* This software is provided "as is" without express or implied
|
||||
* warranty, and with no claim as to its suitability for any purpose.
|
||||
*/
|
||||
#include <iostream>
|
||||
|
||||
/* PRINT_ELEMENTS()
|
||||
* - prints optional C-string optcstr followed by
|
||||
* - all elements of the collection coll
|
||||
* - separated by spaces
|
||||
*/
|
||||
template <class T>
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user