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

Reply via email to