Bypassing the postblit?

bearophile bearophileHUGS at lycos.com
Mon Dec 30 10:44:19 PST 2013


Ritu:

> First of all there is no way in D (at least I am not aware) to 
> disallow the default constructor (the init value must exist).

Do you mean something like this?


struct Foo {
     @disable this();
     this(int) {}
}
void main() {
     // Foo f1; // Error
     auto f2 = Foo(1);
}


Or do you mean this?

struct Bar {}
void main() {
     Bar b = void;
}


Bye,
bearophile


More information about the Digitalmars-d mailing list