Boost logo

Boost :

Subject: Re: [boost] [format] convenient format wrapper
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2013-09-08 19:16:52


On 7/09/2013 08:11, Quoth Alexey Klimkin:
> I found this boost::format wrapper to be very convenient as replacement of
> sprintf. Can something like that be a part of the library?
[...]
> template <typename T, typename... Args> format&
> my_format(format& fmter, T value, Args... args)
> {
> fmter % value;
> return my_format(fmter, args...);
> }

While that's definitely convenient (if you have C++11 variadic
templates, anyway), I suspect that sort of construct would create quite
a bit of code bloat. (Permutational expansion depending on number and
type of parameters.)

The compiler *might* be smart enough to save you from most of it via
inlining, but I'm not sure how far I'd trust that.


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