Boost logo

Boost :

From: Samuel Krempp (krempp_at_[hidden])
Date: 2001-06-29 21:17:21

> I don't like it. I don't know which "both" syntaxes are, but I'd vote for
> one syntax and no spaces.

yeah, space really was not a good choice, but I realised that when writing
Then I tried to choose any other char, and '%' is fine.
even if it already has a meaning, it doesnt make the parsing harder.
and " %1% %2%" look nice, and allow support for the 2 forms.

The first is printf's, with a set of modifying flags (padding numbers with
0 when on the left, adding + to positive numbers, ..... ,precision,
scientific mode vs fixed, and the like.. )

%s means 'next argument please !'
%5$s means 5th argument
%2$-4s means second argument, aligned on left border, and width=4
and lots of funny flags, like
format("%1$d = hex:%1$x oct:%1$o \n") % 18;

The second is "short-positional-notation", in which we
can indicate the number of the argument, nothing more.

%2% for second argument..

> > "only objects with const operator<< defined are formattable".
> > (even if needing to modify the object at print-time sounds like
> > bad-design..)
> Yes it does! In general you are right about the 2^n explosion. I think this
> case might be an exception.

then, could the "format-as-a-function" previous implementation be accepted
into boost ?

> > else, the function approach has some possibilities that can't be beaten by
> > passing arguments through an operator !
> I do like the operator approach, though.

me too.


Boost list run by bdawes at, gregod at, cpdaniel at, john at