Is it valid to cast pointer to struct to array pointer
<p>Given an aggregate struct/class in which every member variable is of the same data type:</p>

<pre><code>struct MatrixStack {
    Matrix4x4 translation { ... };
    Matrix4x4 rotation { ... };
    Matrix4x4 projection { ... };
} matrixStack;
</code></pre>

<p>How valid is it to cast it to an array of its members? e.g.</p>

<pre><code>const Matrix4x4 *ptr = reinterpret_cast&lt;const Matrix4x4*&gt;(&amp;matrixStack);
assert(ptr == &amp;matrixStack.translation);
assert(ptr + 1 == &amp;matrixStack.rotation);
assert(ptr + 2 == &amp;matrixStack.projection);
auto squashed = std::accumulate(ptr, ptr + 3, identity(), multiply());
</code></pre>

<p>I am doing this because in most cases I need named member access for clarity, whereas in some other cases I need to pass the an array into some other API. By using reinterpret_cast, I can avoid allocation.</p>