Another proposal: enforce the user to write:
How do you want to do that? Do you want to enforce it programatically like e.g.
template <>
class vector< Eigen::Matrix< double, 3, 1 > > {
public:
~vector()
{
EIGEN_STATIC_ASSERT(false, STD_VECTOR_REQUIRES_ALIGNED_ALLOCATOR_FOR_THIS_EIGEN_TYPE)
}
};
or do you want to 'enforce' via documentation? I would vote for enforcing it programtically...
std::vector<MyTrickyType,Eigen::aligned_allocator<MyTrickyType> > ....;
with a specialization of std::vector for Eigen::aligned_allocator<> to
workaround the resize() issue
In my opinion this is the best solution since we would get rid of deriving from std::std_vector which on top of other things mentioned in this thread is causing additional problems in MSVC.
Well, I am not an STL specialist but since the alignment issue also holds for other STL containers I just started wondering... what about specializing std::allocator for the required Eigen types? In the end we are talking about the default allocator for a specific type and in case of fixed size Eigen types this should be the aligned_allocator...
Regards,
Hauke