Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2002-01-31 01:51:07


On 1/30/02 10:44 PM, "Ross Smith" <r-smith_at_[hidden]> wrote:

> Samuel Krempp wrote:
>>
>> On Thu, 2002-01-31 at 00:39, Karl Nelson wrote:
>>> Because most people have no liked use of an operator like << and %,
>>> I have switched to a printf style for up to 9 arguments. Ie.
>>>
>>> cout << format("%s, %s %d, %d:%.2d\n", weekday, month, day, hour, min);
>>
>> This is also my favorite.
>> except, of course, the 9-arguments limitation makes the C++ equivalent
>> to C's printf look miserable.
>> (even 100-arguments)
>>
>> if not for that, I would also have made operator% a member function, say
>> 'with(..)', and provide dozens of N-ary constructors, calling with(..)
>> on each argument.
>
> I'll repeat the suggestion I made a while ago:
>
> cout << format("%s, %s %d, %d:%.2d\n")(weekday)(month)(day)(hour)(min);

In case this is not clear: Karl's format3 accepts that syntax for any number
of arguments, but also offers the "plain function call" syntax for 9
arguments or less.

    -- Darin


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