Introspect alias name of an aliased type

ParticlePeter via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 23 03:45:49 PDT 2016


alias uint32_t = uint;

struct Offset() {
   uint32_t x;
   uint32_t y;
}

// Introspect with:

void printStructInfo( T )( T info ) {
   import std.stdio : writefln;
   foreach (memb; __traits(allMembers, T)) {
     writefln(typeof(__traits(getMember, info, memb)).stringof);
   }
}

// Result is uint

Is there a way to get the alias uint32_t instead ?


More information about the Digitalmars-d-learn mailing list