Boost logo

Boost :

From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2003-03-26 12:32:46


> #include <boost/io/format/std/vector.hpp>
> #include <boost/io/format/std/map.hpp>
> #include <boost/io/format/array.hpp>

I am afraid boost/io/format will be confusing in a sight of presence of
Boost.Format.
I would prefer (since it all about container output formatting)

boost/io/container

Also it could be stl instead of std, though it's the matter of taste.

> std::cout << format<value_type>("[", "]\n", " => ")
> << format<map>("","","")
> << values;

...

> Syntax
> ----------
> format<Type>(<start sequence>, <end sequence>, <delimiter>, [<start
> element>, <end element>])[.set_default_format()]
> format<Type>(<set/unset format>)

I personally would really prefer verbose format specification. So I should
not remember what each of the parameters means by it's position.
Something along this lines:

std::cout << start_elelment<value_type>( "[" ) // if you need value
type_here. I am not sure
              << end_element<value_type>( "]\n" )
              << element_delimeter<value_type>( " => " )
              ...
              << values;

Or

std::cout << format<value_type>().start_elelment( "[" ).end_element( "]\n"
).delimeter( " => " )
              ...
              << values;

Or mix of this styles. Or - the very best - all of them.

Gennadiy.


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