aboutsummaryrefslogtreecommitdiff
path: root/Eigen/src/SparseCore/SparseRef.h
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/SparseCore/SparseRef.h')
-rw-r--r--Eigen/src/SparseCore/SparseRef.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/Eigen/src/SparseCore/SparseRef.h b/Eigen/src/SparseCore/SparseRef.h
index d91f38f97..748f87d62 100644
--- a/Eigen/src/SparseCore/SparseRef.h
+++ b/Eigen/src/SparseCore/SparseRef.h
@@ -201,7 +201,7 @@ class Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType
~Ref() {
if(m_hasCopy) {
- TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(m_object_bytes);
+ TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(&m_storage);
obj->~TPlainObjectType();
}
}
@@ -213,7 +213,7 @@ class Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType
{
if((Options & int(StandardCompressedFormat)) && (!expr.isCompressed()))
{
- TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(m_object_bytes);
+ TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(&m_storage);
::new (obj) TPlainObjectType(expr);
m_hasCopy = true;
Base::construct(*obj);
@@ -227,14 +227,14 @@ class Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType
template<typename Expression>
void construct(const Expression& expr, internal::false_type)
{
- TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(m_object_bytes);
+ TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(&m_storage);
::new (obj) TPlainObjectType(expr);
m_hasCopy = true;
Base::construct(*obj);
}
protected:
- char m_object_bytes[sizeof(TPlainObjectType)];
+ typename internal::aligned_storage<sizeof(TPlainObjectType), EIGEN_ALIGNOF(TPlainObjectType)>::type m_storage;
bool m_hasCopy;
};
@@ -319,7 +319,7 @@ class Ref<const SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType
~Ref() {
if(m_hasCopy) {
- TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(m_object_bytes);
+ TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(&m_storage);
obj->~TPlainObjectType();
}
}
@@ -335,14 +335,14 @@ class Ref<const SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType
template<typename Expression>
void construct(const Expression& expr, internal::false_type)
{
- TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(m_object_bytes);
+ TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(&m_storage);
::new (obj) TPlainObjectType(expr);
m_hasCopy = true;
Base::construct(*obj);
}
protected:
- char m_object_bytes[sizeof(TPlainObjectType)];
+ typename internal::aligned_storage<sizeof(TPlainObjectType), EIGEN_ALIGNOF(TPlainObjectType)>::type m_storage;
bool m_hasCopy;
};