No need for specialized std::vector in C++11
Submitted by Michael Becker
Assigned to Nobody
Link to original bugzilla bug (#829)
Version: 3.3 (current stable)
Description
In C++11 the interface of std::vector was changed and functions like resize() are now taking their value_type parameters as reference. This should fix the alignment problem of std::vector entirely and the need for a specialized version unnecessary. So the only thing you have to do in C++11 is use aligned_allocator.
But if you include Eigen/StdVector you introduce a partial template specialization of std::vector into your code which replaces the standard implementation as soon as you use aligned_allocator. This silently gives you a C++98 implementation of std::vector and very hard to find errors when using C++11 features (e.g. initializer lists).
Code to reproduce the error:
#include <vector>
#include <Eigen/Eigen>
#include <Eigen/StdVector> // <- remove this include to make it work
int main()
{
std::vector<Eigen::Vector2d, Eigen::aligned_allocatorEigen::Vector2d> points = { {0,0}, {0,1} };
}
So my suggestion to fix this would be to omit specialization of std::vector in case of C++11.