This forum has been archived. All content is frozen. Please use KDE Discuss instead.

std::vector of classes and aligned_allocator

Tags: None
(comma "," separated)
konolige
Registered Member
Posts
9
Karma
0
OS
It wasn't listed in the docs on aligned_allocator, but if you use std::vector with a class that has Eigen matrices as components, then you have to use the aligned_allocator argument. It's a bit of a mess to always have to do this for iterators etc. This issue only arises (for me) on 32-bit Linux; 64-bit appears ok.

Cheers --Kurt
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Have you read this?

http://eigen.tuxfamily.org/dox/StlContainers.html

It is linked to from there:

http://eigen.tuxfamily.org/dox/Unaligne ... ssert.html

Do you think it should also be linked to from another place? You mention the documentation of aligned_allocator, but this is yet much more 'hidden'...


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
konolige
Registered Member
Posts
9
Karma
0
OS
I was referring to http://eigen.tuxfamily.org/dox/StlContainers.html. If you read this, it says that you must use aligned_allocator when using std::vector (the new version) and other containers: fine. But it neglects to mention that you also need to do this if you use std::vector or another container with your own *class* which has as a member one of the Eigen Matrix fixed-size classes. This is in addition to adding EIGEN_MAKE_ALIGNED_OPERATOR_NEW to the class itself.

It would be nice to make it clear that classes containing fixed-size Eigen matrices as members are subject to the same container rules.

Cheers --Kurt
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Oh! I understand. Yes, good idea, I'll make this change ASAP. Thanks!


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
User avatar
bjacob
Registered Member
Posts
658
Karma
3
I have updated the docs, in both branches. The online docs will be updated next week.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]