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:
@@ -135,31 +135,7 @@ class Matrix
|
||||
public:
|
||||
enum { NeedsToAlign = (Options&Matrix_AutoAlign) == Matrix_AutoAlign
|
||||
&& SizeAtCompileTime!=Dynamic && ((sizeof(Scalar)*SizeAtCompileTime)%16)==0 };
|
||||
typedef typename ei_meta_if<NeedsToAlign, ei_byte_forcing_aligned_malloc, char>::ret ByteAlignedAsNeeded;
|
||||
void *operator new(size_t size) throw()
|
||||
{
|
||||
return ei_aligned_malloc<ByteAlignedAsNeeded>(size);
|
||||
}
|
||||
|
||||
void *operator new(size_t, void *ptr) throw()
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *operator new[](size_t size) throw()
|
||||
{
|
||||
return ei_aligned_malloc<ByteAlignedAsNeeded>(size);
|
||||
}
|
||||
|
||||
void *operator new[](size_t, void *ptr) throw()
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void operator delete(void * ptr) { ei_aligned_free(static_cast<ByteAlignedAsNeeded *>(ptr), 0); }
|
||||
void operator delete[](void * ptr) { ei_aligned_free(static_cast<ByteAlignedAsNeeded *>(ptr), 0); }
|
||||
|
||||
public:
|
||||
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
|
||||
|
||||
EIGEN_STRONG_INLINE int rows() const { return m_storage.rows(); }
|
||||
EIGEN_STRONG_INLINE int cols() const { return m_storage.cols(); }
|
||||
|
||||
Reference in New Issue
Block a user