Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2007-04-04 13:44:30

On 04/04/2007 01:14 PM, Eric Niebler wrote:
> Larry Evans wrote:
>>Proto uses or_ and and_ for alternatives
>>and sequences. It seems that alt_ and seq_ would be closer
>>to the spirit names. Any reason why those names were
>>preferred over alt_ and seq_?
> Because for what they do, or_ and and_ are the right names. :-) You
> realize that these do not create expression templates, right?

Yes, but I guess I need to reread about expression templates.

> They are
> part of proto's meta-grammar facility. If you want to know if an
> expression type E matches grammar G1 or G2, you use:
> proto::matches<E, proto::or_<G1, G2> >
> That's a compile-time boolean test. Proto::and_ behaves similarly. Like
> mpl::or_ and mpl::and_ (and like || and &&) these do short-circuit
> evaluation.
> HTH,

That sort of helps. I guess I was just predisposed to thinking
of them as doing something similar to spirit's alternative<L,R> and
sequence<L,R> templates; however, I guess not. Maybe my confusion is
somehow related to the possiblity of have placeholder's as arguments
to the templates. I understand that this is related to proto's ability
to do transform of the template expressions, OTOH, spirit doesn't
transform templates, only runtime values (via the parse member function).

In short, I need to study proto some more :(

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