mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
* introduce macros to replace inheritance for operator new overloading
(former solution still available and tested) This plays much better with classes that already have base classes -- don't force the user to mess with multiple inheritance, which gave much trouble with MSVC. * Expand the unaligned assert dox page * Minor fixes in the lazy evaluation dox page
This commit is contained in:
@@ -61,8 +61,9 @@ struct Good7 : Eigen::WithAlignedOperatorNew
|
||||
float f; // make the struct have sizeof%16!=0 to make it a little more tricky when we allow an array of 2 such objects
|
||||
};
|
||||
|
||||
struct Good8 : Eigen::WithAlignedOperatorNew
|
||||
struct Good8
|
||||
{
|
||||
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
|
||||
float f; // try the f at first -- the EIGEN_ALIGN_128 attribute of m should make that still work
|
||||
Matrix4f m;
|
||||
};
|
||||
@@ -73,6 +74,13 @@ struct Good9
|
||||
float f;
|
||||
};
|
||||
|
||||
template<bool Align> struct Depends
|
||||
{
|
||||
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(Align)
|
||||
Vector2d m;
|
||||
float f;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void check_unalignedassert_good()
|
||||
{
|
||||
@@ -104,6 +112,8 @@ void unalignedassert()
|
||||
check_unalignedassert_good<Good7>();
|
||||
check_unalignedassert_good<Good8>();
|
||||
check_unalignedassert_good<Good9>();
|
||||
check_unalignedassert_good<Depends<true> >();
|
||||
VERIFY_RAISES_ASSERT(check_unalignedassert_bad<Depends<false> >());
|
||||
}
|
||||
|
||||
void test_unalignedassert()
|
||||
|
||||
Reference in New Issue
Block a user