Suppose one class is declared as having a specific alignment. And that I cannot modify that base class.
#define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a
ATTRIBUTE_ALIGNED16(class) btVector3
{};
class Vector3 : public btVector3
{};
Is it possible to make the derived class Vector3 lose that alignment ?
Under MSVC alignment is quite constraining as it prevents from passing by value. My derived class doesn't particularly need it, and in template writing it is convenient to have classes that can be passed by values.
Be careful - if btVector3 is coming from the Bullet Physics Library (where bt is the prefix on their math functions) the btVector3 is aligned to 16 byte boundaries because of the SIMD math functions. Furthermore, the btVector3 is defined as a union of 4 floats and a 128 bit type, which requires 16 byte alignment in most environments. See http://bulletphysics.org/Bullet/BulletFull/btVector3_8h_source.html
Trying to use the math library without the alignment requirements will cause some operations fail and your methods to act in an undefined way. Better to live with the alignment, or find a different library.