Original Post
I came across a situation where constructing a class along the lines would be convenient. The general idea being a1, a2, ect... can access directly access the data in struct B. Now I can get the same effect with: But then access to the internalData members would require some extra typing. I was wondering if there was any way of getting the same effect, without all the extra typing, that doesn't use anonymous structs (as I hear they are non-standard).
struct A {
void* p1;
void* p2;
};
struct B {
union {
struct {
void* p1;
void* p2;
};
A a1;
A a2;
// ect...
};
};
struct B {
union {
A internalData;
A a1;
A a2;
// ect...
};
};