Since Eigen matrices and vectors use SSE and therefore require a
2010/10/14
: particular alignment, Eigen requires that when these types (specifically, the compile-time sized versions) are within a struct or class, that struct be given the EIGEN_MAKE_ALIGNED_OPERATOR_NEW macro.
What we do require is that e.g. Vector4f's be created at 16 byte aligned locations. EIGEN_MAKE_ALIGNED_OPERATOR_NEW is just one way of doing that.
But here's the problem. What if that struct is allocated by a boost::pool_allocator<T>? Is there any way to enforce alignment then?
That's a question for boost::pool_allocator, not for us; if this allocator doesn't give you 16 byte alignment, then you need a different allocator (or just modify this allocator to meet this criterion).
The allocator is what gives you an address. If it's giving non-16-byte-aligned addresses, then it can't be used.
Benoit
It's now clear that this question belongs firmly on the Boost.Pool side
of the fence, so here it is---I'm wondering why boost::pool_allocator
isn't designed to work with a standard-compliant allocator as its
second template parameter?
I tried creating a boost::fast_pool_allocator