This bugzilla service is closed. All entries have been migrated to
Bug 805 - Suggestion: another aligned pointer work around avoiding EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Summary: Suggestion: another aligned pointer work around avoiding EIGEN_MAKE_ALIGNED_O...
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Documentation (show other bugs)
Version: 3.2
Hardware: All All
: Normal enhancement
Assignee: Nobody
Depends on:
Reported: 2014-05-02 15:49 UTC by Sebastian Schmittner
Modified: 2019-12-04 13:17 UTC (History)
4 users (show)


Description Sebastian Schmittner 2014-05-02 15:49:21 UTC
This is a suggestion for improving the documentation rather than a bug. Sorry for submitting it here, is there some more reasonable place?

The work around of aligning my own classes with
as explained in
can also be avoided by using pointers to Eigen classes, instead of members. This is a little easier than the "Private structure" solution described at the bottom of the page.

just using

class Foo
Eigen::Vector2d  *v;
Foo(...):v(new Eigen::Vector2d()){...}
~Foo(){delete v;...}

instead of 

class Foo
Eigen::Vector2d  v;

fixes the problem as well as the more complicated solutions described in the documentation.
Comment 1 Gael Guennebaud 2014-05-03 19:42:53 UTC
This makes sense if you have only one vector or matrix, but if you have more then it's much better to group them into a helper structure, so I'm not sure about adding this example. Perhaps as a degenerate case of the private structure example?
Comment 2 Christoph Hertzberg 2014-05-03 20:39:21 UTC
The example in the docu, as well as Sebastian's suggestion is flawed, because calling the assignment operator or copy constructor will lead to errors (multiple deallocations). If someone wants to use that solution, smart-pointers should be used (also saves the effort of implementing the destructor).
Comment 3 Nobody 2019-12-04 13:17:35 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance:

Note You need to log in before you can comment on or make changes to this bug.