Boost logo

Boost :

From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2007-06-19 05:11:46


Andrey Semashev wrote:
> Lars Viklund wrote:
>> On Mon, Jun 18, 2007 at 11:48:41PM +0400, Andrey Semashev wrote:
>>> Ion Gazta?aga wrote:
>>>
>>> I have to admit though, that indeed formatting is not a bright side of
>>> the current IO design. I think a better set of manipulators for basic
>>> primitives should do good. There might even be a printf-like manipulator:
>>
>> Do not forget about the mighty fine Boost.Format library. It's already
>> in boost, and is quite capable of type safe printf-like formatting.
>
> That's the key problem - it's like printf, thus makes extensibility for
> user-defined types difficult, if possible.

No, Boost.Format is based on iostreams internally, so it automatically
makes use of any operator<< functions that have been defined for
user-defined types. It is also unlike printf in that it largely
ignores the actual letter in the format specifier; see the recent
thread about uint8_t being formatted as a char even when %d is used,
for example.

All of the current formatted I/O mechanisms have their problems. I
don't have any good ideas about how to fix them, but maybe variadic
templates will give someone a clever idea...

Phil.


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