Mixin Global Variables

Brian White bcwhite at pobox.com
Mon Mar 17 05:54:29 PDT 2008


I want to create a module/global variable as the result of a template 
mixin.  However, this variable needs some sort of "static this" 
initialization.

Is this possible with a single mixin?  (i.e. declare the variable AND 
create a static initializer for it)

In C++, I'd do this with a global static instance of a class with a 
constructor that initializes the instance.  I can't seem to do this with 
D because only classes have constructors and they're always created via 
"new".

Thanks!

-- Brian


More information about the Digitalmars-d-learn mailing list