indexing tuples using strings

BCS ao at
Mon Dec 1 17:14:56 PST 2008

Reply to Bill,

> Isn't there an easier way to fake it using structs? Like
> template Tuple(T...) { alias T Tuple }
> struct STuple(T...) { alias T tuple; }
> alias Tuple!(STuple(int,float), STuple(string,double), int, creal)
> CantFlattenThis;
> And you can write flatteners and nesters for that. Seems like fun,
> maybe I'll waste a few minutes working on that. :-)
> --bb

Yes, that works well. I make lots of use of that in dparse. I end up with 
a struct type that contains the whole AST defining the grammar to be parsed. 
OTOH there is issues (bugs) with aliases when you try to access it under 
some conditions.

More information about the Digitalmars-d mailing list