Boost logo

Boost Users :

Subject: Re: [Boost-users] [phoenix][units] make boost.phoenix play well with boost.units
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-06-03 22:52:01


On 6/4/10 10:31 AM, alfC wrote:
>
>
> On Jun 3, 7:16 pm, Steven Watanabe<watanab..._at_[hidden]> wrote:
>> Joel de Guzman wrote:
>>> When you do a*a with quantity<si::length>, what is the expected
>>> return type?
>>
>> quantity<si::area>
> rigth.
>
> and in case you wonder, Boost.Units has a bunch of template functions
> to obtain
> the result type of arithmetic operations. For example
> boost::units::multiply_typeof_helper<X,Y>::type,
> these are heavily used in boost/units/lambda.hpp, which makes lambda
> play well with units.
>
>>
>>> (looks like a phoenix-2 limitation. hopefully, this will all get sorted
>>> out with phoenix-3).
>
> so, there is no hope with phoenix-2?
> can't we do something temporary like boost/units/lambda.hpp to help
> phoenix-2 to
> deduce the type? is it possible?

There is hope. Just specialize boost::phoenix::result_of_xxx
(e.g. boost::phoenix::result_of_plus<X, Y>).
See phoenix/operator/arithmetic.hpp for example.

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net