Boost logo

Proto :

Subject: Re: [proto] Manipulating an expression tree
From: Karsten Ahnert (karsten.ahnert_at_[hidden])
Date: 2011-04-08 04:28:41


> (Please don't top-post. Rearranging...)

Hmm, I just used reply in my mail client. (Sorry for this double)

>> Another question is: can a node have a state. In my algorithm it would
>> be nice, if every proto::multiplies< > node stores some intermediate
>> values which are used during later evaluations of the tree.
>
> No. Intermediate expression nodes carry no run-time state in their
> nodes. They only carry compile-time information in the form of the tag.
> That's how a plus node is distinguished from a minus node, for instance.
>
> If you need to compute intermediate values, you can use a transform to
> build a parallel structure.

Do you mean to build an entire new tree, or just to replace some nodes?

In my current algorithm I use callable contexts to do the work. I think
this is more favorable since I have to evaluate the tree N times to obtain
the result. I think it would be nice to replace some nodes and customizing
the evaluation context, such that these nodes can be used to store the
intermediates.


Proto list run by eric at boostpro.com