diff --git a/src/Core/Cast.h b/src/Core/Cast.h index f386326a0..50fa72697 100644 --- a/src/Core/Cast.h +++ b/src/Core/Cast.h @@ -26,8 +26,8 @@ #ifndef EIGEN_CAST_H #define EIGEN_CAST_H -template class Cast - : public MatrixBase > +template class Cast : NoDefaultOperatorEquals, + public MatrixBase > { public: typedef NewScalar Scalar; @@ -42,9 +42,6 @@ template class Cast Cast(const Cast& other) : m_matrix(other.m_matrix) {} - // assignments are illegal but we still want to intercept them and get clean compile errors - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Cast) - private: const Cast& _ref() const { return *this; } int _rows() const { return m_matrix.rows(); } diff --git a/src/Core/Conjugate.h b/src/Core/Conjugate.h index dc5eb4653..a529ce630 100644 --- a/src/Core/Conjugate.h +++ b/src/Core/Conjugate.h @@ -26,8 +26,8 @@ #ifndef EIGEN_CONJUGATE_H #define EIGEN_CONJUGATE_H -template class Conjugate - : public MatrixBase > +template class Conjugate : NoDefaultOperatorEquals, + public MatrixBase > { public: typedef typename MatrixType::Scalar Scalar; @@ -42,9 +42,6 @@ template class Conjugate Conjugate(const Conjugate& other) : m_matrix(other.m_matrix) {} - // assignments are illegal but we still want to intercept them and get clean compile errors - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Conjugate) - private: const Conjugate& _ref() const { return *this; } int _rows() const { return m_matrix.rows(); } diff --git a/src/Core/Difference.h b/src/Core/Difference.h index cb065682b..8bebfb9df 100644 --- a/src/Core/Difference.h +++ b/src/Core/Difference.h @@ -26,8 +26,8 @@ #ifndef EIGEN_DIFFERENCE_H #define EIGEN_DIFFERENCE_H -template class Difference - : public MatrixBase > +template class Difference : NoDefaultOperatorEquals, + public MatrixBase > { public: typedef typename Lhs::Scalar Scalar; @@ -47,9 +47,6 @@ template class Difference Difference(const Difference& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - // assignments are illegal but we still want to intercept them and get clean compile errors - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Difference) - private: const Difference& _ref() const { return *this; } int _rows() const { return m_lhs.rows(); } diff --git a/src/Core/Identity.h b/src/Core/Identity.h index 16670dcf9..a5bebbca9 100644 --- a/src/Core/Identity.h +++ b/src/Core/Identity.h @@ -26,8 +26,8 @@ #ifndef EIGEN_IDENTITY_H #define EIGEN_IDENTITY_H -template class Identity - : public MatrixBase > +template class Identity : NoDefaultOperatorEquals, + public MatrixBase > { public: typedef typename MatrixType::Scalar Scalar; @@ -42,9 +42,6 @@ template class Identity assert(RowsAtCompileTime == ColsAtCompileTime); } - // assignments are illegal but we still want to intercept them and get clean compile errors - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Identity) - private: Identity& _ref() { return *this; } const Identity& _ref() const { return *this; } diff --git a/src/Core/NumTraits.h b/src/Core/NumTraits.h index 54e357fbc..c6ce06a97 100644 --- a/src/Core/NumTraits.h +++ b/src/Core/NumTraits.h @@ -81,9 +81,6 @@ template<> inline int random(int a, int b) } template<> inline int random() { - // "rand() % n" is bad, they say, because the low-order bits are not random enough. - // However here, 21 is odd, so random() % 21 uses the high-order bits - // as well, so there's no problem. return random(-10, 10); } inline bool isMuchSmallerThan(int a, int, int = precision()) diff --git a/src/Core/Opposite.h b/src/Core/Opposite.h index b84c1d9cb..9b6cb3093 100644 --- a/src/Core/Opposite.h +++ b/src/Core/Opposite.h @@ -26,8 +26,8 @@ #ifndef EIGEN_OPPOSITE_H #define EIGEN_OPPOSITE_H -template class Opposite - : public MatrixBase > +template class Opposite : NoDefaultOperatorEquals, + public MatrixBase > { public: typedef typename MatrixType::Scalar Scalar; @@ -42,9 +42,6 @@ template class Opposite Opposite(const Opposite& other) : m_matrix(other.m_matrix) {} - // assignments are illegal but we still want to intercept them and get clean compile errors - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Opposite) - private: const Opposite& _ref() const { return *this; } int _rows() const { return m_matrix.rows(); } diff --git a/src/Core/Product.h b/src/Core/Product.h index 0d76ef2c5..5a89d7776 100644 --- a/src/Core/Product.h +++ b/src/Core/Product.h @@ -60,8 +60,8 @@ struct ProductUnroller static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {} }; -template class Product - : public MatrixBase > +template class Product : NoDefaultOperatorEquals, + public MatrixBase > { public: typedef typename Lhs::Scalar Scalar; @@ -81,9 +81,6 @@ template class Product Product(const Product& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - // assignments are illegal but we still want to intercept them and get clean compile errors - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Product) - private: const Product& _ref() const { return *this; } int _rows() const { return m_lhs.rows(); } diff --git a/src/Core/Random.h b/src/Core/Random.h index 62012998d..02b6ff9cc 100644 --- a/src/Core/Random.h +++ b/src/Core/Random.h @@ -26,8 +26,8 @@ #ifndef EIGEN_RANDOM_H #define EIGEN_RANDOM_H -template class Random - : public MatrixBase > +template class Random : NoDefaultOperatorEquals, + public MatrixBase > { public: typedef typename MatrixType::Scalar Scalar; @@ -41,9 +41,6 @@ template class Random assert(rows > 0 && cols > 0); } - // assignments are illegal but we still want to intercept them and get clean compile errors - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Random) - private: const Random& _ref() const { return *this; } int _rows() const { return m_rows; } diff --git a/src/Core/ScalarMultiple.h b/src/Core/ScalarMultiple.h index 1798f06fe..e644769c2 100644 --- a/src/Core/ScalarMultiple.h +++ b/src/Core/ScalarMultiple.h @@ -26,8 +26,8 @@ #ifndef EIGEN_SCALARMULTIPLE_H #define EIGEN_SCALARMULTIPLE_H -template class ScalarMultiple - : public MatrixBase > +template class ScalarMultiple : NoDefaultOperatorEquals, + public MatrixBase > { public: typedef typename MatrixType::Scalar Scalar; @@ -43,9 +43,6 @@ template class ScalarMultiple ScalarMultiple(const ScalarMultiple& other) : m_matrix(other.m_matrix), m_scalar(other.m_scalar) {} - // assignments are illegal but we still want to intercept them and get clean compile errors - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ScalarMultiple) - private: const ScalarMultiple& _ref() const { return *this; } int _rows() const { return m_matrix.rows(); } diff --git a/src/Core/Sum.h b/src/Core/Sum.h index 752ae9abb..e110b3771 100644 --- a/src/Core/Sum.h +++ b/src/Core/Sum.h @@ -26,8 +26,8 @@ #ifndef EIGEN_SUM_H #define EIGEN_SUM_H -template class Sum - : public MatrixBase > +template class Sum : NoDefaultOperatorEquals, + public MatrixBase > { public: typedef typename Lhs::Scalar Scalar; @@ -44,11 +44,7 @@ template class Sum assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); } - Sum(const Sum& other) - : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - - // assignments are illegal but we still want to intercept them and get clean compile errors - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Sum) + Sum(const Sum& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} private: const Sum& _ref() const { return *this; } diff --git a/src/Core/Util.h b/src/Core/Util.h index 59db711a0..a9c08d833 100644 --- a/src/Core/Util.h +++ b/src/Core/Util.h @@ -124,4 +124,11 @@ enum AssertLevel InternalDebugging = 2 }; +//classes inheriting NoDefaultOperatorEquals don't generate a default operator=. +class NoDefaultOperatorEquals +{ + private: + NoDefaultOperatorEquals& operator=(const NoDefaultOperatorEquals&); +}; + #endif // EIGEN_UTIL_H diff --git a/src/Core/Zero.h b/src/Core/Zero.h index 3cea75a68..8cb98ad82 100644 --- a/src/Core/Zero.h +++ b/src/Core/Zero.h @@ -26,8 +26,8 @@ #ifndef EIGEN_ZERO_H #define EIGEN_ZERO_H -template class Zero - : public MatrixBase > +template class Zero : NoDefaultOperatorEquals, + public MatrixBase > { public: typedef typename MatrixType::Scalar Scalar; @@ -41,9 +41,6 @@ template class Zero assert(rows > 0 && cols > 0); } - // assignments are illegal but we still want to intercept them and get clean compile errors - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Zero) - private: const Zero& _ref() const { return *this; } int _rows() const { return m_rows; }