|
Boost : |
From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2007-08-15 07:40:25
On Aug 15, 2007, at 3:19 AM, manphiz wrote:
> Phil Endecott wrote:
>> This stuff will all be much easier once we have variadic templates,
>> i.e. you will be able to have a type-safe sprintf in C++. You can
>> now
>> get a version of gcc that supports them, and they should be in C++0x.
>> So unless you have some very urgent reason to change immediately, I
>> suggest that you wait for a bit.
>>
>> (I imagine that this means that the operator%-style Boost.Format will
>> not progress towards the standard library, but I am not in any
>> position
>> to comment on that.)
>>
>
> Maybe the operator%-style can be obsolete (and I don't like it either)
> in favor of variadic templates magic, but plain sprintf still
> cannot be
> directly used to deal with std::string, is it?
Why not? Variadic templates make it possible to implement a sprintf-
like interface that supports all data types (strings, user-defined
types, etc.) and checks the format string against the actual argument
types to provide better type safety. They give us a chance to revisit
the Format interface to determine whether we can do better with new
features; that might mean bringing back the old-but-familiar (s)
printf interface with added functionality.
- Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk