Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-03-22 23:29:24

Larry Evans wrote:
> On 03/22/08 10:29, Larry Evans wrote:
>> On 03/03/08 15:51, Eric Niebler wrote:
>> [snip]
>>> shift_right<L,R>::type is *very* simple. It is expr<tag::shift_right,
>>> args2<L, R> >. Always. It's just a 2-element container and a tag. If L
>>> and R are expressions, it is an expression. If they're grammars, it is a
>>> grammar, suitable for use as the second template parameter to
>>> proto::matches. It is simple, IMO, and leads to a very straightforward
>> So why is there expr<Tag,Args,Arity>::type if it's always the same
>> as its enclosing class, expr<Tag,Args,Arity>. IIRC, mpl requires it
>> for some metaprogramming reason, but it seems that's an implementation
>> detail; consequently, although the user can use it, there's no need
>> for the user to use it. If so, then why do many of the examples have:
>> terminal<...>::type a_term_expr={{}};
>> instead of just:
>> terminal<...> a_term_expr={{}};
>> ?
> OOPS, I misread. I read "shift_right<L,R>::type is shift_right<L,R>"
> not "shift_right<L,R>::type is expr<tag::shift_right,args2<L,R> >".
> I guess I misread because shift_right<L,R> is a grammar; so, I
> assumed that when L and R are grammars, the expr<shift_right,args2<L,R>
> > grammar would be shirt_right<L,R>.
> Sorry.

You've got it now. In addition, when L and R are grammars,
shift_right<L,R> and expr<tag::shift_right, args2<L,R> > describe the
same set of expressions, even though they are different types. The first
is the short form for the other.

Eric Niebler
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at