Boost logo

Boost :

Subject: Re: [boost] [convert] Now with Boost.Parameter interface.
From: David Abrahams (dave_at_[hidden])
Date: 2009-07-01 20:13:44


on Wed Jul 01 2009, "Vladimir Batov" <batov-AT-people.net.au> wrote:

> From: "David Abrahams" <dave_at_[hidden]>
>> ... What's wrong with
>>
>> int i = convert<int>::from(str, 0, locale_ = new_locale, throw_ = true);
>
> I personally to not feel there is anything wrong per se with the above. The reason I
> did not pursue it was that it introduces a limit on the number of the parameters and I
> did not see it offering any major advantages to balance that shortcoming over the
> supported
>
> int i = convert<int>::from(str, 0)(locale_ = new_locale)(throw_ = true);
>
> On the other hand the supported interface seems to scale considerably better and is no
> longer to type:
>
> int i = convert<int>::from(str, 0)(locale_ = new_locale)(throw_ = true);
> int i = convert<int>::from(str, 0, locale_ = new_locale, throw_ = true);

But again, it has the downside that none of your calls above can return
an actual int. That can have unexpected effects, e.g. in

   some_function_template( convert<int>::from(str, 0) )

when the deduced template argument is actually your proxy type.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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