Subject: Re: [boost] [convert] Now with Boost.Parameter interface.
From: Vladimir Batov (vladimir.batov_at_[hidden])
Date: 2009-07-02 19:15:27
> Scott McMurray <me22.ca+boost <at> gmail.com> writes:
>> Â converter<int>(locale_ = loc, throw_ = true).from(str, 0);
> To me, that's the nicest one yet proposed.
> And it'd be quite reasonable, instead of statics, to just use
> convert<int>().from(str, 0), since that's already common from function
I am not sure I can immediately see the visual advantage of
Functionally, (with everything else equal) #1 has an additional overhead of
creating an object.
> And actually, why not spell from() as operator(), so it can be a
> proper function object?
If I remember correctly, one of the reasons for 'from' was the explicit
directiveness of the conversion -- convert<int>::from(string).
Functionally, the advantage of a static 'from' function over op() is that the
former allows to delay implementation specialization (and, therefore, converter
instantiation) until we know both -- TypeIn and TypeOut -- conversion types.
It's turned out to be quite important as the actual conversion implementation
equally depends on TypeIn as on TypeOut. For that reason I feel that
constructing an instance of converter<TypeOut> (with only TypeOut known) is very
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk