On Jun 3, 7:52 pm, Joel de Guzman <j...@boost-consulting.com> wrote:
On 6/4/10 10:31 AM, alfC wrote: There is hope. Just specialize boost::phoenix::result_of_xxx (e.g. boost::phoenix::result_of_plus<X, Y>).
I specilized result_of_multiplies and still no luck: #include<boost/spirit/home/phoenix.hpp> #include<iostream> #include<typeinfo> #include<boost/units/systems/si.hpp> namespace boost{ namespace phoenix{ using namespace boost::units; template<> //in general template<class XUnit, class YUnit> struct result_of_multiplies<quantity<si::length>, quantity<si::length>
{ typedef quantity<si::area> type; }; }}
using namespace boost::phoenix; using namespace boost::phoenix::arg_names; using namespace boost::units; template<class LambdaExp> void expression_analizer(actor<LambdaExp> l){ std::clog <<"type of argument expression: " <<typeid(LambdaExp).name()<<std::endl; std::clog<<"type of return on double: " <<typeid( typename LambdaExp::template result< basic_environment<double> >::type ).name()<<std::endl; std::clog <<"type of return on quantity<length>: " <<typeid( typename LambdaExp::template result< basic_environment< quantity<si::length> > >::type ).name()<<std::endl; std::clog<<"... should be "<< typeid( quantity<si::length>()*quantity<si::length>() ).name() <<std::endl; } int main(){ expression_analizer(arg1*arg1); return 0; }