I am using Visual C++ on Windows 10.
I want to make class Vector4 such that it has members x, y, z, t and they stored contiguously to provide operator[] and other functions:
class Vector4
{
public:
float operator[](size_t idx)
{
return &x + idx;
}
public:
float x, y, z, t;
}
But I found out that such implementation works not on every compiler(On Visual C++ it works well).
And I dont know how to fix it, maybe write something like this: class alignas(sizeof(float)) Vector4;