Template Collections of Different Types

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 15 19:49:28 PDT 2015


On Sunday, 16 August 2015 at 02:42:18 UTC, BBasile wrote:
> ---
> enum Ti {tibyte, tiubyte, ...}
> Ti getTypeInfo(T)(T t){statif is(t == ubyte) return Ti.tibyte; 
> else...}

You could also just use D's own run time typeinfo with the 
typeid() thing. It returns an instance of class TypeInfo. (This 
is what std.variant does btw)


More information about the Digitalmars-d-learn mailing list