Unions are not something I often used, and looking at a few other questions on them, it seems that there is almost always some kind of warning where they may not work. For instance. structures possibly having unexpected additions or finite differences.
It looks like this in the math library I use, although I wondered if this is an absolutely safe use. I assume that multidimensional arrays do not have an extra complement, and since the type is the same for both definitions, are they guaranteed to occupy exactly the same amount of memory?
template<typename T> class Matrix44T
{
...
union
{
T M[16];
T m[4][4];
} m;
};
Are there any flaws in this setting? Will the order of definition make any difference to how this works?