On Monday, April 25, 2011 06:39:14 PM Christophe Henry wrote:
Hi Thomas,
Sorry to come back to the subject so late, I didn't manage before :(
If you want to use it as a transform you need the evaluator with an
appropriate action that does the desired transform... here is an
example:
struct BuildEventPlusGuard
: proto::when
proto::subscriptproto::terminalevent_tag,
phoenix::meta_grammar ,
TempRownone,proto::_left,none,none,
phoenix::evaluator(proto::_right, some_cool_action())()
{};
Now, some_cool_action can do the transform that BuildGuards was doing.
Hmmm, I get a compiler error, which was expected (would be too easy
otherwise ;- ) ), but the error is surprising. The error is that
phoenix::evaluator seems to believe some_cool_action should be a
random access fusion sequence (expects an environment?).
You are right ... slippery on my side ... evaluator expects a context, which is
a tuple containing the environment and the actions: http://goo.gl/24fU9
Anyway, I am hoping not to write any cool transform but simply save
the type of the phoenix expression so that I can re-create an actor
later. If I need to rewrite differently what BuildGuards was doing, I
gain little. I would like phoenix to do the grammar parsing and
building of actor.
It does ... just pass on proto::_right and it should be good:
struct BuildEventPlusGuard
: proto::when
proto::subscript
proto::terminalevent_tag
, phoenix::meta_grammar // match the phoenix actor
, TempRow
none
, proto::_left
, none
, none
, proto::_right // Pass the type along. which is a phoenix actor.
(proto::_right) // Pass the object along. Which is the actor (1)
{};
(1): Here you can work around the thing with the possibly uninitialized stuff.
Just copy the phoenix actor (should be cheap, if not optimized away completely).
Thanks,
Christophe
___
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto