Boost logo

Proto :

Subject: Re: [proto] vector of proto expressions
From: Nate Knight (Nate.Knight_at_[hidden])
Date: 2011-03-18 12:02:34


On Mar 18, 2011, at 9:17 AM, Karsten Ahnert wrote:

> Hmm, this might work. It is similar to
>
> my_method( fusion::make_vector( i+i , i*i*i , i*i ) , x );
>
> But the expression might become really large, say 100 elements. A
> separation between construction and usage would be nicer.

How about?

    struct expr_list_tag {};

    ...

    terminal<int>::type i = {0};

    // you could wrap this in a function named construct or whatever
    auto e = make_expr<expr_list_tag>(i+i, i*i, i*i*i);

    ...

    do_step(e, x);

I think you need to capture terminals by value to do this kind of thing.


Proto list run by eric at boostpro.com