Implementation of a branch class that performs caching on evaluation. More...
#include <expression_tree.h>
Public Member Functions | |
branch (const typename detail::operation< T >::t &f, const node< T, expression_tree::cache_on_evaluation, ThreadingPolicy > &l, const node< T, expression_tree::cache_on_evaluation, ThreadingPolicy > &r) | |
Default constructor. | |
branch (const branch &o) | |
Copy constructor. | |
virtual T | evaluate () const |
virtual void | grow () |
When this branch grows (e.g. has its children modified), forget that the value was cached. |
Implementation of a branch class that performs caching on evaluation.
A caching-on-evaluation branch will apply its operation on its children when it is evaluated and cache that value if it is constant (e.g. if its children are of constant value).
virtual T expression_tree::cache_on_evaluation< T, ThreadingPolicy >::branch::evaluate | ( | ) | const [inline, virtual] |
If the value of this branch has been cached already, return it. Otherwise, evaluate it and determine if this branch is constant. If it is, considered the value as cached to re-use later.
Reimplemented from expression_tree::detail::default_branch< T, expression_tree::cache_on_evaluation, ThreadingPolicy >.