Boost logo

Boost Users :

Subject: Re: [Boost-users] [phoenix][lambda] lambda to phoenix translation: get arguments from expression
From: alfC (alfredo.correa_at_[hidden])
Date: 2010-05-29 03:48:29


> > with boost.lambda I could extract the different components (Lambda and
> > the actual value stored by value<double>) from f_expr as:
> > get<0>(f_expr.args)  //for lambda
> > and
> > get<1>(get<1>(f_expr.args).args) //for lambda
>
> > what is the equivalent for Boost.phoenix?,

> Check out the extension mechanism (somewhere near the end) where this is
> documented. See composites. Essentially, while lambda uses tuples, phoenix
> uses fusion containers -- more or less the same, but with more horsepower
> (i.e. algorithms and iterators).

I read that part many times but I couldn't realize how to apply it to
this case.
I ended up calling

actor<LambdaExp>(at_c<0>(f_expr))
actor<value<double> >(at_c<1>(at_c<1>(f_expr)))(), //or
at_c<1>(at_c<1>(f_expr)).val

seems to work so far (is there a make_actor?)
I don't know if overall is the best solution.

Thanks,
Alfredo


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