Boost logo

Boost :

Subject: Re: [boost] [Format] Making a change
From: Jeff Flinn (Jeffrey.Flinn_at_[hidden])
Date: 2012-02-15 08:49:52


Olaf van der Spek wrote:
> On Wed, Feb 15, 2012 at 12:16 PM, Vicente Botet
> <vicente.botet_at_[hidden]> wrote:
>>> 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));
>>>
>>>
>> Note that Boost.Format works differently depending on the locale of the
>> Output Stream. So, I guess your proposal is not an option.
>
> Argh, those silly locales again.
>
>> IIRC, when you use explicitly the str function you are stating explicitly
>> that you want to use the default locale.
>>
>> I don't see yet why
>>
>> set(dict2, "link", str(format("../../?q=%s") % name)); // 1
>> set(dict2, "link", format("../../?q=%s") % name); // 2
>>
>> is not satisfactory.
>
> It's still worse than 2.

Which is worse than:

set(dict2, "link", "../../?q=" + name);

Facetiousness aside, how would wstrings be dealt with?

Jeff


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