diff options
Diffstat (limited to 'doc/D09_StructHavingEigenMembers.dox')
-rw-r--r-- | doc/D09_StructHavingEigenMembers.dox | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/doc/D09_StructHavingEigenMembers.dox b/doc/D09_StructHavingEigenMembers.dox index 4ff2b23aa..07b6570dc 100644 --- a/doc/D09_StructHavingEigenMembers.dox +++ b/doc/D09_StructHavingEigenMembers.dox @@ -88,7 +88,7 @@ The solution is to let class Foo have an aligned "operator new", as we showed in \section movetotop Should I then put all the members of Eigen types at the beginning of my class? -No, that's not needed. Since Eigen takes care of declaring 128-bit alignment, all members that need it are automatically 128-bit aligned relatively to the class. So when you have code like +That's not required. Since Eigen takes care of declaring 128-bit alignment, all members that need it are automatically 128-bit aligned relatively to the class. So code like this works fine: \code class Foo @@ -100,25 +100,13 @@ public: }; \endcode -it will work just fine. You do \b not need to rewrite it as - -\code -class Foo -{ - Eigen::Vector2d v; - double x; -public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW -}; -\endcode - \section dynamicsize What about dynamic-size matrices and vectors? -Dynamic-size matrices and vectors, such as Eigen::VectorXd, allocate dynamically their own array of coefficients, so they take care of requiring absolute alignment automatically. So they don't cause this issue. The issue discussed here is only with fixed-size matrices and vectors. +Dynamic-size matrices and vectors, such as Eigen::VectorXd, allocate dynamically their own array of coefficients, so they take care of requiring absolute alignment automatically. So they don't cause this issue. The issue discussed here is only with \ref FixedSizeVectorizable "fixed-size vectorizable matrices and vectors". \section bugineigen So is this a bug in Eigen? -No, it's not our bug. It's more like an inherent problem of the C++ language -- though it must be said that any other existing language probably has the same problem. The problem is that there is no way that you can specify an aligned "operator new" that would propagate to classes having you as member data. +No, it's not our bug. It's more like an inherent problem of the C++98 language specification, and seems to be taken care of in the upcoming language revision: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf">see this document</a>. \section conditional What if I want to do this conditionnally (depending on template parameters) ? |