Re: [eigen] STL Vectors and Alignment

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


For C++03 you need to

#include<Eigen/StdVector>

and then use

std::vector<A, Eigen::aligned_allocator<A> >;

It is explained here:
http://eigen.tuxfamily.org/dox/group__TopicStlContainers.html

Btw, the non-HTML part of your mail is slightly broken.

Cheers,
Christoph

On 26.11.2014 13:48, Gabriel wrote:

*Dear all**,*

Through the documentation which is awesomely cool :-)
I could not figure out the following cases:

*First Case: *

*struct A{**
**    Eigen::Vector2d a;**
**};**
**
**std::vector<A> vec;*


THIS is obviously wrong because there are alignement issues, described
on the page.
Is it enough to fix it like this:

*struct A{**
******EIGEN_MAKE_ALIGNED_OPERATOR_NEW**
**    Vector2d a;**
****
**};**
**std::vector<A> vec;*

Or is this going to fail alignment too*and I need something like this:*
*std::vector<  A  ,   Eigen::aligned_allocator<  A > >*

*Second Case: *

*struct B{**
**    A a;**
**};*
*struct A{*
**    EIGEN_MAKE_ALIGNED_OPERATOR_NEW**
* **    Eigen::Vector2d a;**
**};**
**
**std::vector<B> vec;*

Or is this going to fail alignment too*and I need something like this:*
*std::vector< B  ,   Eigen::aligned_allocator<  B > >*




Thanks a lot for the quick reply =)!
Gabriel




--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



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