Template RTTI

Part of TemplatesCategory

Description

Of questionable usefulness in it's current incantation, but templates do have some support for runtime type identification.

Example

class Thing(T)
{    
}
 
void main()
{
    Thing!(int) thing = new Thing!(int);   
    printf("%.*s\n", thing.classinfo.name);
}

Output

Thing

Source

From digitalmars.D:1842 by Ben Hinkle.