Boost logo

Boost Users :

Subject: Re: [Boost-users] [phoenix][units] make boost.phoenix play well with boost.units
From: alfC (alfredo.correa_at_[hidden])
Date: 2010-06-03 21:02:09


> > 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>() )
>
> Could you please post a minimal cpp file for this one too?

this is a minimal example:

#include<boost/spirit/home/phoenix.hpp>
#include<iostream>
#include<typeinfo>
#include<boost/units/systems/si.hpp>

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;
}
/*************end of example**************************/


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