[phoenix][lambda] lambda to phoenix translation: get arguments from expression

Hi I have a phoenix expression of type actor< composite< divides_eval, vector< LambdaExp, composite< minus_eval, vector< argument<0>, value<double> > > > >
f_expr
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?,
it seems that the phoenix actor doesn't have the member "args".
something like at_c<1>(at_c<1>(f_expr)) seems to be in the right
direction but it returns something of type value<double> from which I
don't know how to extract the value
in the same way at_c<1>(f_expr) returns the denominator, but it is not
an actor, so it is not a lambda expression.
the corresponding lambda type was:
lambda_functor
f_expr
Thank you, Alfredo

On 5/29/2010 11:29 AM, alfC wrote:
Hi I have a phoenix expression of type
actor< composite< divides_eval, vector< LambdaExp, composite< minus_eval, vector< argument<0>, value<double> > > >
f_expr
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?, it seems that the phoenix actor doesn't have the member "args". something like at_c<1>(at_c<1>(f_expr)) seems to be in the right direction but it returns something of type value<double> from which I don't know how to extract the value in the same way at_c<1>(f_expr) returns the denominator, but it is not an actor, so it is not a lambda expression.
the corresponding lambda type was: lambda_functor
, tuple< lambda_functor/ LambdaExp >,// lambda_functor , tuple< lambda_functor< placeholder<1> >, double const //<-- attention adds const to avoid unreadable errors > > > > f_expr
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). Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon

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

On 5/29/2010 3:48 PM, alfC wrote:
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
(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.
Either works fine. Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon
participants (2)
-
alfC
-
Joel de Guzman