D - union feature
- Vathix (19/19) Feb 24 2004 You can put anonymous structs and unions in a union like so:
You can put anonymous structs and unions in a union like so: union Un1 { struct { int a; int b; } } But lets say I want to put MyStruct in the union and have its members directly accessible like the anonymous struct, how about this: union Un2 { MyStruct; } instead of having to copy the struct into the union. If MyStruct has a member foo, I can do this: Un2 u; u.foo = 3; -- Christopher E. Miller www.dprogramming.com irc.dprogramming.com #D
Feb 24 2004