Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2003-03-14 13:06:49


I have an output stream manipulator that allows the user of it to print out
a list in a given range (first, last) or by a container c (c.begin(),
c.end()).

I am looking at adding this into the boost library. The source code for it
is in the attachment (printlist.hpp).

An example of its use is:

std::vector< int > v( 10 );
std::generate( v.begin(), v.end(), std::rand );

// default list: "[ i1, i2, ..., in ]"
std::cout << "list = " << stl::formatlist( v ) << '\n';

// parenthesis: "( i1, i2, ..., in )"
std::cout << "list = " << stl::formatlist( v ).format( '(', ')' ) << '\n';

// special: "[ i1 | i2 | ... | in ]"
std::cout << "list = " << stl::formatlist( v ).format( '|' ).space( true,
true ) << '\n';

At the moment I have only tested it on MS VC++.NET 7.0, but have only used
the C++ standard language and the iostream header, so it should work on
compliant compilers (with non-advanced template support).

Is there any interest for this? Does anyone have comments, suggestions or
questions? How do I go about adding this into boost and making it
boost-compliant?

Thanks for your assistance,

-rhd-
mailto:msclrhd_at_[hidden]

_________________________________________________________________




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk