From 5b95b4daf9933063c57c24c2338b043ec257d461 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Sun, 5 Jun 2016 12:57:48 -0700 Subject: [PATCH] Moved static assertions into the class constructor to make the code more portable --- Eigen/src/Core/CwiseTernaryOp.h | 41 +++++++++++---------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/Eigen/src/Core/CwiseTernaryOp.h b/Eigen/src/Core/CwiseTernaryOp.h index fe71c07cf..9f3576fec 100644 --- a/Eigen/src/Core/CwiseTernaryOp.h +++ b/Eigen/src/Core/CwiseTernaryOp.h @@ -34,22 +34,6 @@ struct traits > { typedef typename result_of::type Scalar; - EIGEN_STATIC_ASSERT( - (internal::is_same::StorageKind, - typename internal::traits::StorageKind>::value), - STORAGE_KIND_MUST_MATCH) - EIGEN_STATIC_ASSERT( - (internal::is_same::StorageKind, - typename internal::traits::StorageKind>::value), - STORAGE_KIND_MUST_MATCH) - EIGEN_STATIC_ASSERT( - (internal::is_same::StorageIndex, - typename internal::traits::StorageIndex>::value), - STORAGE_INDEX_MUST_MATCH) - EIGEN_STATIC_ASSERT( - (internal::is_same::StorageIndex, - typename internal::traits::StorageIndex>::value), - STORAGE_INDEX_MUST_MATCH) typedef typename internal::traits::StorageKind StorageKind; typedef typename internal::traits::StorageIndex StorageIndex; @@ -100,18 +84,8 @@ template ::StorageKind>, - internal::no_assignment_operator { - EIGEN_STATIC_ASSERT( - (internal::is_same< - typename internal::traits::StorageKind, - typename internal::traits::StorageKind>::value), - STORAGE_KIND_MUST_MATCH) - EIGEN_STATIC_ASSERT( - (internal::is_same< - typename internal::traits::StorageKind, - typename internal::traits::StorageKind>::value), - STORAGE_KIND_MUST_MATCH) - + internal::no_assignment_operator +{ public: typedef typename internal::remove_all::type Arg1; typedef typename internal::remove_all::type Arg2; @@ -137,6 +111,17 @@ class CwiseTernaryOp : public CwiseTernaryOpImpl< // require the sizes to match EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg2) EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg3) + + // The index types should match + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + eigen_assert(a1.rows() == a2.rows() && a1.cols() == a2.cols() && a1.rows() == a3.rows() && a1.cols() == a3.cols()); }