diff options
author | 2019-03-17 21:59:30 +0100 | |
---|---|---|
committer | 2019-03-17 21:59:30 +0100 | |
commit | cf7e2e277f76d965fe37dac5a3fecf588f58e3b7 (patch) | |
tree | 821c51fb5c9eca0be5b1d6dbfe86587e938a96c6 /Eigen | |
parent | 1936aac43fb3e0159a2d4f0463769a1925231431 (diff) |
bug #1692: enable enum as sizes of Matrix and Array
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/PlainObjectBase.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h index 4dbc40e5b..6de78fd2f 100644 --- a/Eigen/src/Core/PlainObjectBase.h +++ b/Eigen/src/Core/PlainObjectBase.h @@ -802,8 +802,10 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if<Base::SizeAtCompileTime!=2,T0>::type* = 0) { - EIGEN_STATIC_ASSERT(bool(NumTraits<T0>::IsInteger) && - bool(NumTraits<T1>::IsInteger), + const bool t0_is_integer_alike = internal::is_valid_index_type<T0>::value; + const bool t1_is_integer_alike = internal::is_valid_index_type<T1>::value; + EIGEN_STATIC_ASSERT(t0_is_integer_alike && + t1_is_integer_alike, FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) resize(rows,cols); } @@ -838,9 +840,9 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type && ((!internal::is_same<typename internal::traits<Derived>::XprKind,ArrayXpr>::value || Base::SizeAtCompileTime==Dynamic)),T>::type* = 0) { // NOTE MSVC 2008 complains if we directly put bool(NumTraits<T>::IsInteger) as the EIGEN_STATIC_ASSERT argument. - const bool is_integer = NumTraits<T>::IsInteger; - EIGEN_UNUSED_VARIABLE(is_integer); - EIGEN_STATIC_ASSERT(is_integer, + const bool is_integer_alike = internal::is_valid_index_type<T>::value; + EIGEN_UNUSED_VARIABLE(is_integer_alike); + EIGEN_STATIC_ASSERT(is_integer_alike, FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) resize(size); } |