It looks like using Eigen types with STL containers is very messy and requires special attention to alignment issues. My problem is that I'm planning to create complex class hierarchy with dozens of classes that might include one or more Eigen types as member variables. From the documentation it appears that as soon as you include Eigen type in member variables, your class gets "infected" with same issues as Eigen types. This means I've to take extra care for using STL containers not only for Eigen types but also for all of my dozens of classes.
Even more worse part that worries me is that anyone who uses instances of my classes in their code will have same issues and would be needed to be expert on this subject - even if my classes didn't expose any Eigen types in their public interface!
This is quite frustrating. Questions I have,
- Is my understanding above correct (I only need to support C++11 and modern compilers)?
- Is there any pattern people use so they don't have to pollute their code with special Eigen handling all over places?
- I'm thinking about disabling whole vectorization globally. Would that resolve above issues at the cost of performance? Can it be enabled selectively for only specific code?
- If I forget to take care of alignment issue somewhere in code, do I always get compile time error OR issue might remain hidden and there can be crash at runtime?