Classes and CTFE

Andrea Fontana via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 10 05:56:18 PST 2016


I used to think that classes can't be used with CTFE.

Instead it appears to work, if they're not directly returned but, 
for example, they're wrapped inside a struct as on example [1]. 
Ctor is called *only* at compile time, and instance works fine.

So, I can't understand: why wrapping a class inside a struct make 
it works?


Ex: http://dpaste.dzfl.pl/5879511dff02




More information about the Digitalmars-d-learn mailing list