C++11 gave us to possibility to use non-POD types within unions, say I have the following piece of code;
union
{
T one;
V two;
} uny;
Somewhere within my class, only one member will be active at a time, now my questions are rather simple.
- What is the default value of uny? - undefined?
- Whenever my class is destructed, which members (within the union), if any will be destructed?
- Suppose I have to std::typeinfo to keep track of which is the active member, should I then call the destructor explicitly on that member in the destructor?
- Does anyone have a link to the language proposal, which changed unions to accept non-POD types?