Boost logo

Boost Users :

From: Jeff Flinn (yg-boost-users_at_[hidden])
Date: 2003-09-03 11:07:47

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;


  std::ostream_iterator<int> lItr( s, lDelim.c_str() );

  std::copy( lInts.begin(), lInts.end(), lItr );



I'm thinking something like the following usage would be nice:

    s << range_streamer( lInts.begin(), lInts.end(), "{", "," "}" );



Any thoughts?

Jeff Flinn
Applied Dynamics, International

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at