3 Sep
2003
3 Sep
'03
4:07 p.m.
Before rolling my own, does boost have a facility to stream out an iterator range without the dangling delimiter at the end? For example std::ostream& operator<<( std::ostream& s, const MyClass& aC ) { const std::string lDelim( "," ); std::vector<int> lInts; lInts.push_back(1); lInts.push_back(2); lInts.push_back(3); std::ostream_iterator<int> lItr( s, lDelim.c_str() ); std::copy( lInts.begin(), lInts.end(), lItr ); } yields: 1,2,3, I'm thinking something like the following usage would be nice: s << range_streamer( lInts.begin(), lInts.end(), "{", "," "}" ); yielding: {1,2,3} Any thoughts? -- Jeff Flinn Applied Dynamics, International