From: Eric Niebler (eric_at_[hidden])
Date: 2007-07-01 11:13:19
Eric Niebler wrote:
> dan marsden wrote:
>> As phoenix expressions have operator(), I'm already using an expression wrapper around all my proto expressions, so I presume that is where I would add any special member support?
> Yep. You could be to put all such members into the Phoenix expression
> wrapper and use a grammar to flag or disallow invalid uses. The members
> would just be Proto terminals, like "terminal<phoenix::tag::else_>::type
> const else_".
Oh wait, that's not quite what you want, because then if_[e1].else_[e2]
will chop off the if_ part of the tree. What you need instead is a
member like (untested):
template<typename Expr ...>
: proto::extends<Expr ...>
pheonix::tag::else_ // else is now an "operator"
, phoenix_expr const
>::type const else_;
Then, if_/else_ statements would conform to the following grammar:
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk