|
Boost : |
Subject: Re: [boost] [Format] Making a change
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-02-14 21:51:48
On Tue, Feb 14, 2012 at 4:18 AM, Olaf van der Spek <ml_at_[hidden]> wrote:
[...]
> > 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);
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk