So basically, this is what I've got so far. I have a mat4
class, which is made up of __m128
's and need to be aligned on a 16-byte boundry:
_MM_ALIGN16
class mat4
{
...
};
I have another class which itself is not aligned, but contains a mat4
.
class OtherClass
{
private:
mat4 matrix;
// Other data whose alignment doesn't really matter
...
};
I need to dynamically allocate instances of OtherClass
, ala:
OtherClass* stuff = new OtherClass[n];
How can I guarantee that the mat4
inside the instance(s) will be properly aligned, while still calling mat4
's constructor?
I can (and generally prefer to) use C++11's features, perhaps aligned_storage
is what I'm looking for? How would I use it in this case?