Suppose I have the following struct:
import std.stdio;
struct A
{
this (int arg = 1) {
writeln("Correct constructor");
}
this();
}
How to use the default value of the constructor?
The
void main()
{
A a = A();
}
...produces Error: constructor app.A.this is not callable because it is annotated with @disable. If I remove @disable attribute from default constructor, I would not get my own constructor executed.
And, why structs aren't allowed to have custom default constructor anyway?