On Wednesday, 2 October 2019 at 17:37:57 UTC, Brett wrote:
X y = {3};works fine. So one has to do x[0] = y;
You could initialize x all at once. Complete example:
import std.stdio;
struct Point {
int x, y;
string toString() {
import std.format : format;
return format("(%d, %d)", x, y);
}
}
void main() {
Point[2] ps = [{0,0}, {4,4}];
foreach (p; ps) writeln(p);
}
