Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-02-11 15:05:08


> > Does this really add a whole lot of value
> > cout << format("%{1:hex,width=10,pad=0} %{2:dec}")(a)(b);
> > over
> > cout << format("%010x %d")(a)(b);
>
> It certainly does.

I'm starting to like MS' formatting approach where

format("{2} is {1:fmt}", x, y)

is translated into

to_string(y) + " is " + to_string(y, "fmt").

This combined with a default formatter that understands printf-like syntax
would look like

format("{2:10} is {1:6.3f}", "test", 0.5);

Naturally, the default formatter would be user-replaceable, enabling people
to add verbosity as desired.


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