Boost logo

Boost :

Subject: Re: [boost] [format] convenient format wrapper
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2013-09-09 05:19:21


On 09-09-2013 01:16, Gavin Lambert wrote:
> 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.

It seems like what is now being proposed for standardization.

If there is code-bloat, then just report this in the documentation.

-Thorsten


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