Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-06-29 22:20:02

----- Original Message -----
From: "Samuel Krempp" <krempp_at_[hidden]>

> > I don't like it. I don't know which "both" syntaxes are, but I'd vote
> > one syntax and no spaces.
> yeah, space really was not a good choice, but I realised that when writing
> examples.
> 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,

Not to me, FWIW.

> 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..
> etc..

This was the one I wanted most in my challenge. I don't like the idea that
such a simple usage gets cluttered with extra % signs. Could we move the
extra % to the printf syntax somehow?

> > > "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
> > case might be an exception.
> then, could the "format-as-a-function" previous implementation be accepted
> into boost ?

I guess so. Maybe somebody else will have a counterargument. I like the lack
of arg limitations in your implementation.


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