
On Tue, Apr 19, 2011 at 5:34 AM, alfC
Hi,
In Phoenix2 I used to have the following code to add expressions of type pow<N>(... expr...) which where useful for expressions involving Boost.Units. Is it possible to do something similar with Phoenix3. The usage if macros in the tutorial examples obscures how to add template parameters to the phoenix expression.
Well. the intention was to not obscure but ease the process of adding new expressions. Your hint has been noted, i will explain what this macro does with an example.
In Phoenix2 it was straight forward, but I can figure out how to do this in Phoenix3.
The process is simple: 1) Define the expression, this means: 1.1) Define how the proto expression will look like 1.2) Define what expressions will match 1.3) Hook the expression up in the Actions mechanism This is done by the macro. Cause the code for that will look almost the same everytime. 2) Define what's to be done in the default_actions (usually call some other functor with the expressions children) 3) Write a generation function. Please have a look at: http://svn.boost.org/svn/boost/trunk/boost/phoenix/fusion/at.hpp