Q:

Is it possible to skip bytes when using union, in c++?

I'm attempting to use a union for a couple of structs, specfically aligning a 2D (4 by 4) float array with 4 Vector4's. 
From my understanding, union looks at the sequential bytes from the first. If I have a 4x4 array and want to get a whole column, I would need to skip 16 bytes to get to the next row.
Example:
Matrix = {{a, b, c, d},
          {e, f, g, h},
          {h, i, j, k},
          {l, m, n, o};

if the data is given such that a 1D array is {a,b,c,d,e,..., o}, how would I get the last column (d,h,k,o)?
So how would I get the bytes: 12->16, 28->32, 44->48, 60->64?
the code I have that returns the last row (not what I want), is:
//matrix.h
struct Matrix4 {
    union{
        float values[4][4];
        Vector4 column[4];
    };

    //matrix methods etc
}

//main.cpp
Matrix4 position = Matrix3::translation(Vector3(1,2,3));
Vector4 column = position.column[2];
std::cout << (column) << std::endl;

The output matrix would be (don't remember how to use LaTex formatting sorry):
| 1 0 0 1 |
| 0 1 0 2 |
| 0 0 1 3 |
| 0 0 0 1 |

So the column I want is:
|1|
|2|
|3|
|1|

and the union gives: 
|0|
|0|
|0|
|1|

(the last row, not column).
Would it just be easier to refactor my code to use a 1D array to get the sequential bytes or should I change how my matricies are constructed? or can I handle this with some other thing in union?
EDIT: My question is different to this other question because I already have created a matrix class and allocated memory. My question looks at the functionality of "union" and its limits, as well as using my definied struct 'Vector4' as a means of representing some data in a matrix. I'm looking into the possibility of skipping bytes to receive data that doesn't directly follow each other, not how to allocate said bytes.

A:

This is a fairly common pattern, but an invalid one. It's popular because it's easy, and because mainstream compilers have traditionally permitted and supported it.
But you simply cannot, in a well-defined way, make use of unions in this manner. Unions are not a way to reinterpret data of one type as data of another type. Heck, reinterpret_cast doesn't even get you there: to do it safely you'd have to keep std::copying your bytes back and forth. The only time it's safe is with a char[] (or unsigned char[], or std::byte[]) which is allowed to alias arbitrary blocks of memory: as a consequence, unions can be useful for quick byte inspection. Beyond that, they are useful only if you don't need to use more than one of the union's members at a time.
What you should really be doing is picking one layout/format, then adding your own operator[] (or other function) variants on top to provide different interfaces and ways of interpreting the data at your call site.
Do it right and there'll not be any overhead.
Do it cleverly and you'll be able to apply your transformation "on the fly" in just the way you need. Provide a proxy type, a kind of iterator, that doesn't just iterate in linear sequence but instead iterates in the modified sequence that you need.
This logic can all be encapsulated in your Matrix4 type.

