Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] Recreating an expression
From: Eric Niebler (eric_at_[hidden])
Date: 2009-07-03 18:41:59


Here's a little extra feedback that I forgot include in my first reply.

christophe henry wrote:
> These terminals are used with a simple grammar:
> struct BuildGuards
> : proto::or_<
> proto::when<
> proto::logical_or<BuildGuards,BuildGuards >,
>
> GuardOR<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
> >,
> proto::when<
> proto::logical_and<BuildGuards,BuildGuards >,
>
> GuardAND<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
> >,
> proto::when<
> proto::logical_not<BuildGuards >,
> GuardNOT<BuildGuards(proto::_value)>()

Use proto::_child instead of proto::_value here. proto::_value returns
the value of a terminal node. proto::_child returns the child of a unary
expression tree node. It's really just luck that this is working for you.

> >,
> proto::when <
> proto::terminal<guard_tag>,
> proto::_()

I would use proto::_ here instead of proto::_(). They mean the same
thing, but proto::_ is more idiomatic. See the following section for an
explanation of why proto::_ and proto::_() are equivalent when used as
transforms:

http://www.boost.org/doc/libs/1_39_0/doc/html/proto/users_guide.html#boost_proto.users_guide.back_end.expression_transformation.data.implicit_parameters_to_primitive_transforms

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net