Boost logo

Boost :

Subject: Re: [boost] [convert] Now with Boost.Parameter interface.
From: Vladimir Batov (batov_at_[hidden])
Date: 2009-07-02 05:02:40


> From: "David Abrahams" <dave_at_[hidden]>
> ...
>> 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.

Yes, that is a fair point. The way around it is

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

Returning the value (rather than a proxy) was *very* tempting... but seemed
*very* limiting. Like chaining of additional configuration parameters
(notably i/o stream manipulatiors) would be impossible. Still, I'll take
another look if I can see things differently this time around.

V.


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