diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-01-08 15:20:21 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-01-08 15:20:21 +0000 |
commit | 1d52bd4cad64d8d8662f40c11210b705351b43ab (patch) | |
tree | c8fe83368e8e13ba7e8ec0c4ef078f5293cfea4d /doc/UnalignedArrayAssert.dox | |
parent | e2d2a7d2226b85569a9360b9738c15498fb454ac (diff) |
the big memory changes. the most important changes are:
ei_aligned_malloc now really behaves like a malloc
(untyped, doesn't call ctor)
ei_aligned_new is the typed variant calling ctor
EIGEN_MAKE_ALIGNED_OPERATOR_NEW now takes the class name as parameter
Diffstat (limited to 'doc/UnalignedArrayAssert.dox')
-rw-r--r-- | doc/UnalignedArrayAssert.dox | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/doc/UnalignedArrayAssert.dox b/doc/UnalignedArrayAssert.dox index 8fdd74fae..8a001dfa3 100644 --- a/doc/UnalignedArrayAssert.dox +++ b/doc/UnalignedArrayAssert.dox @@ -10,7 +10,7 @@ namespace Eigen { - \ref stillstillstuck - \ref movetotop - \ref bugineigen - - \ref nomacro + - \ref conditional <hr> \section what What kind of code made this assertion fail? @@ -54,7 +54,7 @@ class Foo Eigen::Vector2d v; ... public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + EIGEN_MAKE_ALIGNED_OPERATOR_NEW(Foo) }; ... @@ -144,7 +144,7 @@ class Foo double x; Eigen::Vector2d v; public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + EIGEN_MAKE_ALIGNED_OPERATOR_NEW(Foo) }; \endcode @@ -156,7 +156,7 @@ class Foo Eigen::Vector2d v; double x; public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + EIGEN_MAKE_ALIGNED_OPERATOR_NEW(Foo) }; \endcode @@ -168,25 +168,6 @@ Dynamic-size matrices and vectors, such as Eigen::VectorXd, allocate dynamically 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. -\section nomacro I don't like macros! Any solution with inheritance? - -Yes, you can let your class Foo publicly inherit Eigen::WithAlignedOperatorNew, like this: - -\code -class Foo : public Eigen::WithAlignedOperatorNew -{ - ... - Eigen::Vector2d v; - ... -}; - -... - -Foo *foo = new Foo; -\endcode - -This solution gives the same result as the macro. It has the disadvantage that if Foo already had a base class, you are now doing multiple inheritance, and this situation is sometimes handled wrongly by certain compilers -- we've been having trouble with MSVC. The solution with the macro is therefore safer. - \section conditional What if I want to do this conditionnally (depending on template parameters) ? For this situation, we offer the macro EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign). It will generate aligned operators like EIGEN_MAKE_ALIGNED_OPERATOR_NEW if NeedsToAlign is true. It will generate operators with the default alignment if NeedsToAlign is false. @@ -202,7 +183,7 @@ template<int n> class Foo Vector v; ... public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) + EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(Foo,NeedsToAlign) }; ... |