Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-12-19 13:35:18


From: "s_krempp" <krempp_at_[hidden]>
> library format provides a class which parses a printf-like format
> strings, and then formats one or several variables using streams,
> whose flags and parameters are set according to the format-string
> directives.

Choices.html, first bullet argues that boost::format("...") % expr1 % expr2
is way cooler than boost::sprintf("...", expr1, expr2).

I don't really have a problem with the % syntax (except for the operator
precedence, perhaps) but choices.html doesn't do a very good job of
explaining its benefits.

One non-obvious advantage of the sprintf-like syntax (the obvious advantage
is of course sprintf "compatibility") is that sprintf() can detect arity
errors.

I think that both forms can be useful depending on the context, so both
should be provided.

Also, I think that the str() free function should be named to_string.

--
Peter Dimov
Multi Media Ltd.

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