Registered Member
|
Hello,
I have been trapped is the evil unaligned array assertion. I have a structure A that have some Vector2d inside and I want a vector of A. When I resize it, the assertion fails. I read the web page and add all the stuffs but it seems to me that it is only useful if I use directly a std::vector of Vector2d and not a std::vector of A that contains a Vector2d. Am I wrong? What is the workaround? Thanks a lot. I use linux with a ubuntu 8.04, I have taken the tarball of the stable eigen-2.0, and I compile my code with g++-4.2 Here follows a minimal example of the problem: #include #include #include #include #include using namespace Eigen; struct A { Vector2d point; double o; inline A() :o(0.5) {} EIGEN_MAKE_ALIGNED_OPERATOR_NEW }; int main() { std::vector pleins; pleins.resize(100); std::cout << "Fails" << std::endl; } |
Registered Member
|
Hm OK you hit a really really bad corner case where you hit simultaneously 2 causes for this assertion.
Yes std::vector hits the same problem as std::vector because A contains a Vector2d. We need to do something about that, please give us some time. Probably we should provide you with a macro to easily do the same with std::vector as we already do for std::vector. Just FYI, #include does #include for you.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Moderator
|
note that using:
will fix most of the trouble. Still remains the resize(int,T) issue... |
Registered Member
|
I'm afraid this is a big issue... so we need to provide an easy way to add std::vector specializations for custom types. EDIT: hm ok now that I read your message on the list, you're right, this is not practical, your solution is better.
Last edited by bjacob on Fri Feb 06, 2009 6:37 pm, edited 1 time in total.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
is it in the last svn version, or do I have to include a special header ? Because it does not even compile with the code I provide and the version of eigen, I use. - Best regards, by the way, the objectives of eigen are great, and as long as I use 3d object, everything works fine. |
Registered Member
|
|
Registered Member
|
Something is not very clear for, should I used the above code or the latter:
because both compile and execute fine. Thanks to clarify that. |
Moderator
|
btw, the correct version should be:
However with latest trunk, simply doing:
should work fine now! (make sure you #include before including , or don't include at all) |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell