![]() |
Home | Libraries | People | FAQ | More |
Proto provides some ready-made context classes that you can use as-is, or that you can use to help while implementing your own contexts. They are:
An evaluation context that assigns the usual C++ meanings to all the operators. For example, addition nodes are handled by evaluating the left and right children and then adding the results. The proto::default_context uses Boost.Typeof to deduce the types of the expressions it evaluates.
A simple context that recursively evaluates children but does not combine the results in any way and returns void.
A helper that simplifies the job of writing context classes. Rather than writing template specializations, with proto::callable_context<> you write a function object with an overloaded function call operator. Any expressions not handled by an overload are automatically dispatched to a default evaluation context that you can specify.