CT info about class' children

Yuriy via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 22 02:20:58 PDT 2014


Hello, is there a way of getting CT info of a class' children?

If no, what do you think of a new feature for DMD: template this 
static ctors/dtors:

class A
{
     static this(this T)()
     {
         writeln("static this(", T.stringof, ")");
     }
}

class B : A
{

}

would output:
static this(A)
static this(B)

how it works:
when instantiating (shared) static ctors/dtors of class C, DMD 
will look for template_this_static_ctors/dtors in C, and all of 
it's superclasses, instantiating each with C as this, and adding 
such instances to C as regular static ctors/dtors.


More information about the Digitalmars-d mailing list