From 023773beaa221c340bc6a0f583db7859f61b8313 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Sun, 30 Sep 2007 14:56:11 +0000 Subject: [PATCH] Fix super-nasty bug in the declaration of the storage array of fixed-size matrices. Also some simplifications. --- src/internal/MatrixOps.h | 11 ++++------- src/internal/MatrixRef.h | 1 - src/internal/MatrixStorage.h | 2 +- src/internal/ScalarOps.h | 6 ++---- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/internal/MatrixOps.h b/src/internal/MatrixOps.h index cad341db8..480b7bef9 100644 --- a/src/internal/MatrixOps.h +++ b/src/internal/MatrixOps.h @@ -48,7 +48,7 @@ template class EiSum EiSum(const EiSum& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - + EI_INHERIT_ASSIGNMENT_OPERATORS(EiSum) private: @@ -194,8 +194,7 @@ template Derived & EiObject::operator+=(const EiObject& other) { - *this = *this + other; - return *static_cast(this); + return *this = *this + other; } template @@ -203,8 +202,7 @@ template Derived & EiObject::operator-=(const EiObject &other) { - *this = *this - other; - return *static_cast(this); + return *this = *this - other; } template @@ -212,8 +210,7 @@ template Derived & EiObject::operator*=(const EiObject &other) { - *this = *this * other; - return *static_cast(this); + return *this = *this * other; } #endif // EI_MATRIXOPS_H diff --git a/src/internal/MatrixRef.h b/src/internal/MatrixRef.h index 7f45b36d1..7bf3ebe44 100644 --- a/src/internal/MatrixRef.h +++ b/src/internal/MatrixRef.h @@ -48,7 +48,6 @@ template class EiMatrixConstRef return m_matrix._read(row, col); } - protected: const MatrixType& m_matrix; }; diff --git a/src/internal/MatrixStorage.h b/src/internal/MatrixStorage.h index 8e44ae6de..b3b3f9e06 100644 --- a/src/internal/MatrixStorage.h +++ b/src/internal/MatrixStorage.h @@ -32,7 +32,7 @@ template \ Derived & \ EiObject::operator*=(const OtherScalar &other) \ { \ - *this = *this * other; \ - return *static_cast(this); \ + return *this = *this * other; \ } \ \ template \ Derived & \ EiObject::operator/=(const OtherScalar &other) \ { \ - *this = *this / other; \ - return *static_cast(this); \ + return *this = *this / other; \ } EI_MAKE_SCALAR_OPS(int)