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 18:28:28


On 6/3/10 6:11 PM, alfC wrote:
> I have and expression of type
>
> arg1*arg1
>
> which is contained in a deduced type LambdaExp (more preciselly
> composite<multiplies_eval,vector<argument<0>, argument<0> >)
>
> when trying to see what is the phoenix-deduced return type when input
> is double
>
> typename LambdaExp::template result<basic_environment<double> >::type
>
> naturally, it gives 'double' (double*double)
>
> but when the input type is a boost::units::quantity
>
> typename LambdaExp::template
> result<basic_environment<quantity<si::length> > >::type
>
> it gives:
>
> error_cant_deduce_type
> (instread of the equivalent of quantity<si::area>, like in
> quantity<si::area> a = quantity<si::length>()*quantity<si::length>() )
>
> this is strange since it seemed that Phoenix worked out of the box
> with Units.
>
> What is going on? How can we help Phoenix deduce the return type?
> Does Phoenix need this help, like Boost.Lambda does by means of boost/
> units/lambda.hpp?

Could you please post a minimal cpp file for this one too?
You are right, it should work out of the box. Not sure, but it
might be a bug. Phoenix2 type deduction, while better than Lambda,
is still unwieldy. This will all be fixed in 3.0.

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