这个结构可以MyWrapStruct:
struct MyWrapStruct
{
bool myBool;
union
{
struct
{
void* myPtr;
int myInt;
};
Struct1 myStruct1;
Struct2 myStruct2;
} myStructs;
};
使用“子结构”:
struct Struct1
{
void* myPtr;
int myInt;
float mySpecialFloat;
};
struct Struct2
{
void* myPtr;
int myInt;
int mySpecialInt;
};
被视为POD结构?
答案 0 :(得分:2)
是的 - 甚至联合类型只包含数据,也没有方法,构造函数等。
请参阅:
<强>更新强> 当然,只要联合只包含POD类型。
请参阅: