
"Reece Dunn" <msclrhd@hotmail.com> writes:
I'm generally not a great fan of statefulness, but this also seems like a reasonable thing to want:
namespace io = boost::io; std::cout << io::sequence_delimiters("{ ", " }"); std::cout << io::sequence( vec ); // output: { 1, 2, 3 }
You can achieve something like this using:
io::formatter< const char * > fmt( "{ ", " }" ); std::cout << io::sequence( vec ).format( fmt );
If there are any better alternatives, I am willing to listen.
Well, I think my alternative is better if you want a stateful change, since yours doesn't accomplish that. My suggestion is certainly consistent with normal io manipulators. The point is to stream a bunch of sequences without having to repeat the format part. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com