Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2002-02-11 17:57:19


----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, February 11, 2002 1:05 PM
Subject: Re: [boost] Re: Boost.Format syntax

> > > 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").

I also like this. It has the advantages of 'printf' (terse readable
syntax) combined with the advantage of iostreams (user extensibility).
Another advantage is that it yields a string directly, so you can do
things like 'widget.set_label(<format_expression>)'.

--
Rainer Deyke | root_at_[hidden] | http://rainerdeyke.com

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