From 51b361b3bb40d547ecf39e4c2e90a806c56c9751 Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Fri, 2 Aug 2013 21:07:39 +0200 Subject: Ensure that (potentially aligned) stack objects are passed by reference. --- Eigen/src/Core/DenseStorage.h | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'Eigen/src/Core/DenseStorage.h') diff --git a/Eigen/src/Core/DenseStorage.h b/Eigen/src/Core/DenseStorage.h index ae86b4d11..67507db28 100644 --- a/Eigen/src/Core/DenseStorage.h +++ b/Eigen/src/Core/DenseStorage.h @@ -118,7 +118,11 @@ template class DenseSt DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()) {} DenseStorage(const DenseStorage& other) : m_data(other.m_data) {} - DenseStorage& operator=(DenseStorage other) { other.swap(*this); return *this; } + DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) m_data = other.m_data; + return *this; + } DenseStorage(DenseIndex,DenseIndex,DenseIndex) {} void swap(DenseStorage& other) { std::swap(m_data,other.m_data); } static DenseIndex rows(void) {return _Rows;} @@ -168,7 +172,16 @@ template class DenseStorage class DenseStorage class DenseStorage