I 've just read the Structures having static members eigen page. The latter states the following:
If you define a structure having members of fixed-size vectorizable Eigen types, you must overload its "operator new" so that it generates 16-bytes-aligned pointers. Fortunately, Eigen provides you with a macro EIGEN_MAKE_ALIGNED_OPERATOR_NEW that does that for you.
However it's not clear to me whether we should also use the EIGEN_MAKE_ALIGNED_OPERATOR_NEW
macro for class instances that hold other class instances which in turn hold the fixed-size containers?
For example, in class A of the followin snippet, is the EIGEN_MAKE_ALIGNED_OPERATOR_NEW needed?
#include <Eigen/Core>
class B
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
Eigen::Vector2d v;
};
class A
{
public:
B b;
};
int main(int argc, char *argv[])
{
B* b = new B(); // this should have no alignement problems as we use EIGEN_MAKE_ALIGNED_OPERATOR_NEW
A* a = new A(); // how about this one?
return 0;
}