Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-09-27 12:52:53


Roland Richter wrote:
> John Torjo wrote:
>
>> Dear boosters,
>>
>> There's been quite a hot debate about "Output Formatters" library.
>>
>> Reece has provided some input facilies in this library as well.
>> This has drawn people to either sides: some don't want these input
>> facilities, while others do.
>>
>> To conclude, I would like to ask you to vote:
>> - "Yes" - in favor of Input facilities
>> - "No" - don't want Input facilities.
>
> I vote "Yes", but I realize that I'm already outnumbered
> and I'm too late.
>
> The dilemma I see is that the outfmt library is somewhere
> between serialization (boost::serialization) and pretty-printing
> (boost::format). IMO, outfmt provides *both* at a basic level
> in that it simply adds streaming operators << and >> to STL
> containers, which, for some reason, are currently missing.

And why just support operator << for the STL containers and not >>? If I
drop input facilities from my library, this is what will happen. Also,
you'd need to implement operator >> somehow for the STL containers in
order to be complete. The question then becomes: how?

I have been working on improving my library based on the feedback from
the review and one of the things that has been revised is the input
facilities, making them sit more naturally with the input streams
framework, removing the need to provide a special wrapper around an
input stream.

> Then, again, the name "Output formatters" is already misleading.

Which will most likely become the Collection I/O Framework (io::collection).

>> Thorsten Ottosen wrote:
>>
>>> "Reece Dunn" <msclrhd_at_[hidden]> wrote in message
>>>
>>> | [2] The direct result of not supporting [1] is that you cannot utilize
>>> | Roland Richter's usage:
>>> |
>>> | std::list<char> cl = lexical_cast< std::list<char> >( "[ a, b,
>>> c ]" );
>>>
>>> just a remark: this can be done with boost.assign:
>>>
>>> std::list<char> cl = list_of('a')('b')('c');
>
> Not if the string "[ a, b, c ]" comes from a file or, as in my
> case, from the Java side via a JNI interface.
>
> This does not require much formatting; to be precise, it requires
> formatting just because lexical_cast does not accept whitespace.

I have thought about this: in the operator>> body, save the old skipws
flag state and enable whitespace skipping; proceed to input the
collection; restore the state of the skip flag.

Regards,
Reece


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