"In a nutshell" one can do the following:
for_each(a.begin(), a.end(), std::cout << _1 << ' ');
(where a is something like std::list<int>)
Is there any trick to print out something like
std::map
On Fri, 04 Mar 2005 16:59:12 -0500, Jason House
"In a nutshell" one can do the following: for_each(a.begin(), a.end(), std::cout << _1 << ' ');
(where a is something like std::list<int>)
You can cout the contents of container a with spaces between using: copy( a.begin(), a.end(), ostream_iterator< a::value_type >( cout, ' ' ) ); No boost required. Hopefully someone with more boost experience can give an elegant solution for a more general case ( such as your map< string, list<int> > ). - Scott McMurray
me22 wrote:
On Fri, 04 Mar 2005 16:59:12 -0500, Jason House
wrote: "In a nutshell" one can do the following: for_each(a.begin(), a.end(), std::cout << _1 << ' ');
(where a is something like std::list<int>)
You can cout the contents of container a with spaces between using: copy( a.begin(), a.end(), ostream_iterator< a::value_type >( cout, ' ' ) );
No boost required. Hopefully someone with more boost experience can give an elegant solution for a more general case ( such as your map< string, list<int> > ).
You can try this: http://www.kangaroologic.com/format_lite/ Jonathan
participants (3)
-
Jason House
-
Jonathan Turkanis
-
me22