2

Can this structure MyWrapStruct:

struct MyWrapStruct
{
    bool myBool;
    union
    {
        struct
        {
            void* myPtr;
            int myInt;
        };
        Struct1 myStruct1;
        Struct2 myStruct2;
    } myStructs;
};

With "sub-structures" :

struct Struct1
{
    void* myPtr;
    int myInt;
    float mySpecialFloat;
};

struct Struct2
{
    void* myPtr;
    int myInt;
    int mySpecialInt;
};

Be considered a POD structure?

Jonas
  • 121,568
  • 97
  • 310
  • 388
wip
  • 2,313
  • 5
  • 31
  • 47

1 Answers1

2

Yes - even union types merely contains data, and no methods, constructors, etc.

See:

What are POD types in C++?

Update Provided, of course, the union only contains POD types.

See:

Questions regarding C++ non-POD unions

Doug
  • 644
  • 1
  • 6
  • 22