From f6aa60bcf3542ad28822ecdd2ab817963b3e747a Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Tue, 27 Jan 2009 15:40:05 +0000 Subject: centralize those static asserts more upstream, reduces duplication and ensures they can't be bypassed (e.g. until now it was possible to bypass the static assert on sizes) --- Eigen/src/Core/Assign.h | 4 ++-- Eigen/src/Core/Matrix.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'Eigen/src') diff --git a/Eigen/src/Core/Assign.h b/Eigen/src/Core/Assign.h index 42b411e6f..c4e2d5e75 100644 --- a/Eigen/src/Core/Assign.h +++ b/Eigen/src/Core/Assign.h @@ -401,6 +401,8 @@ EIGEN_STRONG_INLINE Derived& MatrixBase ::lazyAssign(const MatrixBase& other) { EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived) + EIGEN_STATIC_ASSERT((ei_is_same_type::ret), + YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) ei_assert(rows() == other.rows() && cols() == other.cols()); ei_assign_impl::run(derived(),other.derived()); return derived(); @@ -437,8 +439,6 @@ template EIGEN_STRONG_INLINE Derived& MatrixBase ::operator=(const MatrixBase& other) { - EIGEN_STATIC_ASSERT((ei_is_same_type::ret), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) return ei_assign_selector::run(derived(), other.derived()); } diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index b6d940b39..482afe890 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -503,8 +503,6 @@ class Matrix EIGEN_STRONG_INLINE Matrix& _set_noalias(const MatrixBase& other) { _resize_to_match(other); - EIGEN_STATIC_ASSERT((ei_is_same_type::ret), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) // the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because // it wouldn't allow to copy a row-vector into a column-vector. return ei_assign_selector::run(*this, other.derived()); -- cgit v1.2.3