Boost logo

Boost :

Subject: Re: [boost] [Format] Making a change
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-02-14 07:18:25


On Tue, Feb 14, 2012 at 6:04 AM, Daryle Walker <darylew_at_[hidden]> wrote:
> Wasn't there recently another thread about this?  If you didn't read that thread, it referredto another thread from 7 years ago about the same thing.  Boost.Format already provides amember function and a free function to convert a format object to a string.  The conversionsthrow if the format object hasn't had all of its parameters filled in.  You want to add a thirdmethod?

Yes, please

> Unlike int vs. double, a formatting object and a string are NOT conceptually the samething, so adding an implicit conversion would be bad.  (Actually, we should limit implicitconversions in general; so converting 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);

-- 
Olaf

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