any way to initialize an array of structs to void?

ref2401 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 16 07:45:04 PDT 2015


struct MyStruct {
	@disable this();

	this(int a, string b) {
		this.a = a;
		this.b = b;
	}

	int a;
	string b;
}

I know there is a way to create one instance of `MyStruct` and 
initialize it to void.
   MyStruct s = void;
   s = MyStruct(5, "abcdef");

How can initialize an array of `MyStruct` instances to void?
   auto arr = new MyStruct[10]; // compile-time Error: default 
construction is disabled for type MyStruct.


More information about the Digitalmars-d-learn mailing list