Static constructors in structs.

TheFlyingFiddle via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 30 13:23:43 PDT 2015


Is this intended to work?

struct A
{
    __gshared static this()
    {
       //Add some reflection info to some global stuff.
       addReflectionInfo!(typeof(this));
    }
}

I just noticed this works in 2.069, is this intended? I mean I 
love it! It makes it possible to do lot's of useful mixins for 
runtime reflection for example. Just wondering if I can start 
writing code this way or if it's a regression and is going away. 
I think this did not work a year ago when I tried doing something 
like this.


More information about the Digitalmars-d-learn mailing list