ponce

bearophile bearophileHUGS at lycos.com
Tue Nov 9 10:42:34 PST 2010


ponce:

> Are these things possible at compile-time?
> 1 - instancing templated struct/class and using them

Currently classes can't be created at compile time, this fails:


class Foo {}
int bar() {
    Foo f = new Foo;
    return 0;
}
enum int ignore = bar();
void main() {}


But this limit may be eventually removed for some well behaved classes (like classes with pure methods that don't contain other things forbidden in CTFE). Don is more expert on this and he is probably able to give you a better answer.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list