Any structinfo .. ? How do I get struct name at compile-time or runtime?
hasan.aljudy at gmail.com
Fri Nov 3 20:16:24 PST 2006
Is it possible to get the name of the struct automagically? It doesn't
have to be at runtime, I just need it at compile time .. really.
I hoped I could do the following, but it doesn't work:
return this.stuctinfo.name; //no such thing!!!
Well .. right now I'm reading object.d and it seems there's a
TypeInfo_Struct class .. but how do I get access to it?
I just tried:
char name = (cast(TypeInfo_Struct)typeid(x)).name;
writefln( name );
but it prints out the full qualified name of the struct ... (in my case,
isn't there a straight forward way to get the struct name, like
classinfo.name for classes?
More information about the Digitalmars-d-learn