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
  • 109,920
  • 93
  • 295
  • 369
wip
  • 2,205
  • 3
  • 30
  • 46

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
  • 604
  • 1
  • 6
  • 22