On Wednesday, 11 December 2013 at 23:36:11 UTC, bearophile wrote:
In D you can't define a struct/union and use it to define an instance on the fly.

Well, you can if it is anonymous.

struct Foo {
    union {
        struct { ubyte a; ubyte b; }
        ubyte[2] arr;
    }
}

That works in D, and it makes foo.a == arr[0] and foo.b == arr[1];

Reply via email to