Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2008-03-02 21:34:28

On 03/02/08 20:19, Eric Niebler wrote:
> Larry Evans wrote:
>> On 03/02/08 19:39, Eric Niebler wrote:
>> [snip]
>>> Your problem distills down to:
>>> typedef terminal<x> GX; // grammar for x
>>> typedef GX::type EX; // expression for x
>>> typedef shift_right<GX, GX> SRGX; // grammar for x>>x
>>> typedef SRGX::type SREX; // OOPS!
>>> You then try to use SREX as a valid expression type, and it is not. It
>>> should be:
>>> typedef shift_right<EX, EX>::type SREX;
>>> The difference is that in the first case, you're creating the type of a
>>> right shift expression where the operands are grammars. You really want
>>> the operands to be expression types.
>> I'd be more comfortable if the validity of the nested type
>> didn't depend on particular type of the template parameter.
> It doesn't.

If the template arguments are grammars then shift_right<L,R>::type is
not an expression type. AFAICT, it's of no use. OTOH, If the template
arguments are expression types then shift_right<L,R>::type is an
expression type, at least according to what you say above. So maybe
I should have said the "usefulness" instead of "validity".

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