Subject: Re: [boost] [Format] Making a change
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2012-02-15 06:16:00
Nathan Ridge wrote
>> From: jeffrey.hellrung@
>> On Tue, Feb 14, 2012 at 4:18 AM, Olaf van der Spek <ml@> wrote:
>> > > Unlike int vs. double, a formatting object and a string are NOT
>> > conceptually the samething, so adding an implicit conversion would be
>> > (Actually, we should limit implicitconversions in general; so
>> > weakly-connected types should definitely be out.)
>> > Why would that be bad? The conversion from format to string is well
>> > defined and used (very) frequently. It's also cumbersome at the
>> > moment.
>> > 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
> 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.
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));
is not satisfactory.
-- View this message in context: http://boost.2283326.n4.nabble.com/Format-Making-a-change-tp4383214p4390084.html Sent from the Boost - Dev mailing list archive at Nabble.com.