Boost logo

Boost :

Subject: Re: [boost] [Format] Making a change
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-02-15 03:42:16


On Wed, Feb 15, 2012 at 4:27 AM, Nathan Ridge <zeratul976_at_[hidden]> wrote:
>> > Compare:
>> > 1: set(dict2, "link", (boost::format("../../?q=%s") % name).str());
>> > 2: set(dict2, "link", boost::format("../../?q=%s") % name);
>>
>>
>> I don't see a problem with 1. It makes your conversion intentions clear,
>> and I don't find it onerous in the least.
>>
>> (My opinion, of course.)
>>
>> - Jeff
>
> Upon some reflection, neither of these look natural to me.
>
> What would look natural is the following, implemented using C++11 variadic
> templates (and then the return value could be a string in the first place):
>
> set(dict2, "link", boost::format("../../?q=%s", name));

Yes, that'd be even better, but variadic templates won't be an option
(for me) any time soon.

-- 
Olaf

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