DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Write STL Container To Output Stream

  • submit to reddit
//write all elements without any delimiter
copy (coll.begin(), coll.end(), ostream_iterator(cout));
reff : josutis, pg. 278

//with boost
for_each(coll.begin(), coll.end(), cout << _1);