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


Reply via email to