On Monday, 14 August 2017 at 14:24:40 UTC, Steven Schveighoffer wrote:

I think what the docs mean is that as soon as an anonymous union is present, you can't initialize anything further than the first union field.

I understood that, hence my remark that "this is not helpful".

So it seems I am forced to assign explicitly to each member of the struct, an ugly process.

What is a nice way to solve this problem?

I think the only way to solve it is with a constructor:

this(int ival, double xval) { i = ival; x = xval; }

As I though I made clear, I don't want write assignments to each variable in a 50 or 100 member struct from a library when D could supply a better solution. I can print out such a struct using writeln, but can find no way to use that text cleaned up in source code to create such a struct. Is D completely deficient here?

Reply via email to