
Eric Niebler wrote:
Also look into proto::functional::unpack_expr, which turns a Fusion sequence into a proto expression node. For instance, you might turn an N-ary expression into an (N+1)-ary expression representing a function invocation like (untested) ...
when< nary_expr< _, vararg
> , function< vararg >( // #1 functional::unpack_exprtag::function( // #2 push_front(_, terminal > >()) // #3 ) ) > The idea here is to create an expression that, when evaluated by proto::function's pass-through transform (#1), does the Right Thing. You can accomplish that by first building a new expression from the old that (a) has an extra argument in the 0th position that is a terminal containing your function object, and (b) has a tag type of tag::function. First you build a new sequence with push_front (#3), and then you unpack that Fusion sequence into a new expression (#2).
push_front doesn't exist yet; you'll have to write it. Just create a callable function object that does what fusion::push_front does. OK, I like the idea. I tried to get it working but I stumple against the fatc that proto make_expr takes push_front() as a Sequence and don't try to evaulate it before hand, leading to a "no size for psuh_front" erro in fusion. I'll try to get this sorted though.
My main question is that, when and when not a transform call get evaluated ? Like if i do foo( bar ( _) ) is bar(_) evaluated before being evaluated by foo ? Sometimes it seems it does and sometimes no :/ -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35