[eigen] Eigen 2 alignment errors in VS2010

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

I am attempting to create a struct

struct Triangle
   Eigen::Vector2d verts[3];

and then to create a vector of triangles:

vector<Triangle> tris(20);

However, this is causing the following compile error under Visual Studio 2010: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(870): error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned
There is no error under g++ 4.5.0.

As far as I can tell, this occurs because a Triangle is passed to the vector's resize() function by value, and you can't make any promises about the alignment of function parameters passed by value apparently.

Is there any kind of workaround for this issue?

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/