How to get inner most nested struct
bauss via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Mar 16 22:40:00 PDT 2017
On Friday, 17 March 2017 at 01:52:20 UTC, Hussien wrote:
> On Friday, 17 March 2017 at 01:19:54 UTC, Adam D. Ruppe wrote:
>> On Friday, 17 March 2017 at 00:34:22 UTC, Hussien wrote:
>>> Anyway to do this?
>>
>> I don't think you can, the inner anonymous structs are just to
>> organize the members and group them inside the union.
>
> ;/ D should retain the structure in some way and allow for one
> to traverse it.
Declare them as separate structs and simply put them in there.
Ex.
struct Foo {
int bar;
int baz;
}
struct Foo2 {
union {
long bar;
Foo baz;
// Equal to:
/*
struct {
int bar;
int baz;
}
*/
}
}
Only way I could think of achieving this.
More information about the Digitalmars-d-learn
mailing list