Boost logo

Boost Users :

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


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<lambda_functor_base<
                arithmetic_action<divide_action>,
                tuple<
                        lambda_functor<//
                                LambdaExp
>,//
                        lambda_functor<lambda_functor_base<
                                        arithmetic_action<minus_action>,
                                        tuple<
                                                lambda_functor<
                                                        placeholder<1>
>,
                                                double const // <-- attention adds const to avoid unreadable
errors
>
> >
>
> > f_expr

Thank you,
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