Cleanup: Modernize internal utilities for C++14 libeigen/eigen!2518
diff --git a/Eigen/src/CholmodSupport/CholmodSupport.h b/Eigen/src/CholmodSupport/CholmodSupport.h index 047156f..0705d9c 100644 --- a/Eigen/src/CholmodSupport/CholmodSupport.h +++ b/Eigen/src/CholmodSupport/CholmodSupport.h
@@ -83,9 +83,9 @@ res.dtype = 0; res.stype = -1; - if (internal::is_same<StorageIndex_, int>::value) { + if (std::is_same<StorageIndex_, int>::value) { res.itype = CHOLMOD_INT; - } else if (internal::is_same<StorageIndex_, SuiteSparse_long>::value) { + } else if (std::is_same<StorageIndex_, SuiteSparse_long>::value) { res.itype = CHOLMOD_LONG; } else { eigen_assert(false && "Index type not supported yet"); @@ -260,14 +260,14 @@ public: CholmodBase() : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) { - EIGEN_STATIC_ASSERT((internal::is_same<double, RealScalar>::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); + EIGEN_STATIC_ASSERT((std::is_same<double, RealScalar>::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); m_shiftOffset[0] = m_shiftOffset[1] = 0.0; internal::cm_start<StorageIndex>(m_cholmod); } explicit CholmodBase(const MatrixType& matrix) : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) { - EIGEN_STATIC_ASSERT((internal::is_same<double, RealScalar>::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); + EIGEN_STATIC_ASSERT((std::is_same<double, RealScalar>::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); m_shiftOffset[0] = m_shiftOffset[1] = 0.0; internal::cm_start<StorageIndex>(m_cholmod); compute(matrix);
diff --git a/Eigen/src/Core/Array.h b/Eigen/src/Core/Array.h index a56b8ab..8dfb976 100644 --- a/Eigen/src/Core/Array.h +++ b/Eigen/src/Core/Array.h
@@ -247,8 +247,7 @@ template <typename OtherDerived> EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Array( const EigenBase<OtherDerived>& other, - std::enable_if_t<internal::is_convertible<typename OtherDerived::Scalar, Scalar>::value, PrivateType> = - PrivateType()) + std::enable_if_t<std::is_convertible<typename OtherDerived::Scalar, Scalar>::value, PrivateType> = PrivateType()) : Base(other.derived()) {} EIGEN_DEVICE_FUNC constexpr Index innerStride() const noexcept { return 1; }
diff --git a/Eigen/src/Core/Assign.h b/Eigen/src/Core/Assign.h index 84774c6..baec68b 100644 --- a/Eigen/src/Core/Assign.h +++ b/Eigen/src/Core/Assign.h
@@ -22,7 +22,7 @@ template <typename OtherDerived> EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::lazyAssign( const DenseBase<OtherDerived>& other) { - enum { SameType = internal::is_same<typename Derived::Scalar, typename OtherDerived::Scalar>::value }; + enum { SameType = std::is_same<typename Derived::Scalar, typename OtherDerived::Scalar>::value }; EIGEN_STATIC_ASSERT_LVALUE(Derived) EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived, OtherDerived)
diff --git a/Eigen/src/Core/AssignEvaluator.h b/Eigen/src/Core/AssignEvaluator.h index 0bc5fca..d40b9fb 100644 --- a/Eigen/src/Core/AssignEvaluator.h +++ b/Eigen/src/Core/AssignEvaluator.h
@@ -62,7 +62,7 @@ : MaxRowsAtCompileTime; static constexpr int RestrictedInnerSize = min_size_prefer_fixed(MaxInnerSizeAtCompileTime, MaxPacketSize); static constexpr int RestrictedLinearSize = min_size_prefer_fixed(MaxSizeAtCompileTime, MaxPacketSize); - static constexpr int OuterStride = outer_stride_at_compile_time<Dst>::ret; + static constexpr int OuterStride = outer_stride_at_compile_time<Dst>::value; // TODO: distinguish between linear traversal and inner-traversal packet types. using LinearPacketType = typename find_best_packet<DstScalar, RestrictedLinearSize>::type;
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index d848ce4..b02798b 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h
@@ -43,10 +43,10 @@ : XprTypeIsRowMajor, HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor), InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), - InnerStrideAtCompileTime = HasSameStorageOrderAsXprType ? int(inner_stride_at_compile_time<XprType_>::ret) - : int(outer_stride_at_compile_time<XprType_>::ret), - OuterStrideAtCompileTime = HasSameStorageOrderAsXprType ? int(outer_stride_at_compile_time<XprType_>::ret) - : int(inner_stride_at_compile_time<XprType_>::ret), + InnerStrideAtCompileTime = HasSameStorageOrderAsXprType ? int(inner_stride_at_compile_time<XprType_>::value) + : int(outer_stride_at_compile_time<XprType_>::value), + OuterStrideAtCompileTime = HasSameStorageOrderAsXprType ? int(outer_stride_at_compile_time<XprType_>::value) + : int(inner_stride_at_compile_time<XprType_>::value), // FIXME, this traits is rather specialized for dense object and it needs to be cleaned further FlagsLvalueBit = is_lvalue<XprType_>::value ? LvalueBit : 0, @@ -64,7 +64,7 @@ }; template <typename XprType, int BlockRows = Dynamic, int BlockCols = Dynamic, bool InnerPanel = false, - bool HasDirectAccess = internal::has_direct_access<XprType>::ret> + bool HasDirectAccess = internal::has_direct_access<XprType>::value> class BlockImpl_dense; } // end namespace internal
diff --git a/Eigen/src/Core/ConcatOp.h b/Eigen/src/Core/ConcatOp.h index eadbc05..7167995 100644 --- a/Eigen/src/Core/ConcatOp.h +++ b/Eigen/src/Core/ConcatOp.h
@@ -99,12 +99,12 @@ template <typename OriginalLhsType, typename OriginalRhsType> EIGEN_DEVICE_FUNC constexpr inline Concat(const OriginalLhsType& lhs, const OriginalRhsType& rhs) : m_lhs(lhs), m_rhs(rhs) { - EIGEN_STATIC_ASSERT((internal::is_same<std::remove_const_t<LhsType>, OriginalLhsType>::value), + EIGEN_STATIC_ASSERT((std::is_same<std::remove_const_t<LhsType>, OriginalLhsType>::value), THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) - EIGEN_STATIC_ASSERT((internal::is_same<std::remove_const_t<RhsType>, OriginalRhsType>::value), + EIGEN_STATIC_ASSERT((std::is_same<std::remove_const_t<RhsType>, OriginalRhsType>::value), THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) EIGEN_STATIC_ASSERT( - (internal::is_same<typename LhsType::Scalar, typename RhsType::Scalar>::value), + (std::is_same<typename LhsType::Scalar, typename RhsType::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) EIGEN_STATIC_ASSERT_SAME_XPR_KIND(LhsType, RhsType) EIGEN_STATIC_ASSERT(Direction != Horizontal || int(LhsType::RowsAtCompileTime) == Dynamic ||
diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h index 791398d..53f39da 100644 --- a/Eigen/src/Core/CoreEvaluators.h +++ b/Eigen/src/Core/CoreEvaluators.h
@@ -452,7 +452,7 @@ CoeffReadCost = functor_traits<NullaryOp>::Cost, Flags = (evaluator<PlainObjectTypeCleaned>::Flags & - (HereditaryBits | (functor_has_linear_access<NullaryOp>::ret ? LinearAccessBit : 0) | + (HereditaryBits | (functor_has_linear_access<NullaryOp>::value ? LinearAccessBit : 0) | (functor_traits<NullaryOp>::PacketAccess ? PacketAccessBit : 0))) | (functor_traits<NullaryOp>::IsRepeatable ? 0 : EvalBeforeNestingBit), Alignment = AlignedMax @@ -921,8 +921,8 @@ Arg1Flags = evaluator<Arg1>::Flags, Arg2Flags = evaluator<Arg2>::Flags, Arg3Flags = evaluator<Arg3>::Flags, - SameType = is_same<typename Arg1::Scalar, typename Arg2::Scalar>::value && - is_same<typename Arg1::Scalar, typename Arg3::Scalar>::value, + SameType = std::is_same<typename Arg1::Scalar, typename Arg2::Scalar>::value && + std::is_same<typename Arg1::Scalar, typename Arg3::Scalar>::value, StorageOrdersAgree = (int(Arg1Flags) & RowMajorBit) == (int(Arg2Flags) & RowMajorBit) && (int(Arg1Flags) & RowMajorBit) == (int(Arg3Flags) & RowMajorBit), Flags0 = (int(Arg1Flags) | int(Arg2Flags) | int(Arg3Flags)) & @@ -1047,7 +1047,7 @@ LhsFlags = evaluator<Lhs>::Flags, RhsFlags = evaluator<Rhs>::Flags, - SameType = is_same<typename Lhs::Scalar, typename Rhs::Scalar>::value, + SameType = std::is_same<typename Lhs::Scalar, typename Rhs::Scalar>::value, StorageOrdersAgree = (int(LhsFlags) & RowMajorBit) == (int(RhsFlags) & RowMajorBit), Flags0 = (int(LhsFlags) | int(RhsFlags)) & (HereditaryBits | @@ -1188,7 +1188,7 @@ m_innerStride(map.innerStride()), m_outerStride(map.outerStride()) { EIGEN_STATIC_ASSERT(check_implication((evaluator<Derived>::Flags & PacketAccessBit) != 0, - inner_stride_at_compile_time<Derived>::ret == 1), + inner_stride_at_compile_time<Derived>::value == 1), PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1); EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } @@ -1319,7 +1319,7 @@ // -------------------- Block -------------------- template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel, - bool HasDirectAccess = has_direct_access<ArgType>::ret> + bool HasDirectAccess = has_direct_access<ArgType>::value> struct block_evaluator; template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel> @@ -1344,10 +1344,10 @@ : ArgTypeIsRowMajor, HasSameStorageOrderAsArgType = (IsRowMajor == ArgTypeIsRowMajor), InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), - InnerStrideAtCompileTime = HasSameStorageOrderAsArgType ? int(inner_stride_at_compile_time<ArgType>::ret) - : int(outer_stride_at_compile_time<ArgType>::ret), - OuterStrideAtCompileTime = HasSameStorageOrderAsArgType ? int(outer_stride_at_compile_time<ArgType>::ret) - : int(inner_stride_at_compile_time<ArgType>::ret), + InnerStrideAtCompileTime = HasSameStorageOrderAsArgType ? int(inner_stride_at_compile_time<ArgType>::value) + : int(outer_stride_at_compile_time<ArgType>::value), + OuterStrideAtCompileTime = HasSameStorageOrderAsArgType ? int(outer_stride_at_compile_time<ArgType>::value) + : int(inner_stride_at_compile_time<ArgType>::value), MaskPacketAccessBit = (InnerStrideAtCompileTime == 1 || HasSameStorageOrderAsArgType) ? PacketAccessBit : 0, FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || @@ -1480,20 +1480,20 @@ protected: EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE CoeffReturnType - linear_coeff_impl(Index index, internal::true_type /* ForwardLinearAccess */) const { + linear_coeff_impl(Index index, std::true_type /* ForwardLinearAccess */) const { return m_argImpl.coeff(m_linear_offset.value() + index); } EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE CoeffReturnType - linear_coeff_impl(Index index, internal::false_type /* not ForwardLinearAccess */) const { + linear_coeff_impl(Index index, std::false_type /* not ForwardLinearAccess */) const { return coeff(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); } EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar& linear_coeffRef_impl( - Index index, internal::true_type /* ForwardLinearAccess */) { + Index index, std::true_type /* ForwardLinearAccess */) { return m_argImpl.coeffRef(m_linear_offset.value() + index); } EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar& linear_coeffRef_impl( - Index index, internal::false_type /* not ForwardLinearAccess */) { + Index index, std::false_type /* not ForwardLinearAccess */) { return coeffRef(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); }
diff --git a/Eigen/src/Core/CwiseTernaryOp.h b/Eigen/src/Core/CwiseTernaryOp.h index ea137ae..dcb62d2 100644 --- a/Eigen/src/Core/CwiseTernaryOp.h +++ b/Eigen/src/Core/CwiseTernaryOp.h
@@ -95,11 +95,11 @@ EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg3) // The index types should match - EIGEN_STATIC_ASSERT((internal::is_same<typename internal::traits<Arg1Type>::StorageKind, - typename internal::traits<Arg2Type>::StorageKind>::value), + EIGEN_STATIC_ASSERT((std::is_same<typename internal::traits<Arg1Type>::StorageKind, + typename internal::traits<Arg2Type>::StorageKind>::value), STORAGE_KIND_MUST_MATCH) - EIGEN_STATIC_ASSERT((internal::is_same<typename internal::traits<Arg1Type>::StorageKind, - typename internal::traits<Arg3Type>::StorageKind>::value), + EIGEN_STATIC_ASSERT((std::is_same<typename internal::traits<Arg1Type>::StorageKind, + typename internal::traits<Arg3Type>::StorageKind>::value), STORAGE_KIND_MUST_MATCH) typedef typename CwiseTernaryOpImpl<TernaryOp, Arg1Type, Arg2Type, Arg3Type,
diff --git a/Eigen/src/Core/CwiseUnaryView.h b/Eigen/src/Core/CwiseUnaryView.h index a16da5c..4749333 100644 --- a/Eigen/src/Core/CwiseUnaryView.h +++ b/Eigen/src/Core/CwiseUnaryView.h
@@ -29,7 +29,7 @@ Flags = traits<MatrixTypeNested_>::Flags & (RowMajorBit | FlagsLvalueBit | DirectAccessBit), // FIXME DirectAccessBit should not be handled by expressions - MatrixTypeInnerStride = inner_stride_at_compile_time<MatrixType>::ret, + MatrixTypeInnerStride = inner_stride_at_compile_time<MatrixType>::value, // need to cast the sizeof's from size_t to int explicitly, otherwise: // "error: no integral type can represent all of the enumerator values InnerStrideAtCompileTime = @@ -40,9 +40,9 @@ : int(StrideType::InnerStrideAtCompileTime), OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 - ? (outer_stride_at_compile_time<MatrixType>::ret == Dynamic + ? (outer_stride_at_compile_time<MatrixType>::value == Dynamic ? int(Dynamic) - : outer_stride_at_compile_time<MatrixType>::ret * + : outer_stride_at_compile_time<MatrixType>::value * int(sizeof(typename traits<MatrixType>::Scalar) / sizeof(Scalar))) : int(StrideType::OuterStrideAtCompileTime) };
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index e9317e4..5588b41 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h
@@ -106,7 +106,7 @@ * it is set to the \a Dynamic constant. * \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */ - SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::ret), + SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::value), /**< This is equal to the number of coefficients, i.e. the number of * rows times the number of columns, or to \a Dynamic if this is not * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */ @@ -170,8 +170,8 @@ : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), - InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::ret, - OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::ret + InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::value, + OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::value }; typedef typename internal::find_best_packet<Scalar, SizeAtCompileTime>::type PacketScalar; @@ -200,8 +200,8 @@ * the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed * that the return type of eval() is either PlainObject or const PlainObject&. */ - typedef std::conditional_t<internal::is_same<typename internal::traits<Derived>::XprKind, MatrixXpr>::value, - PlainMatrix, PlainArray> + typedef std::conditional_t<std::is_same<typename internal::traits<Derived>::XprKind, MatrixXpr>::value, PlainMatrix, + PlainArray> PlainObject; /** \returns the outer size. @@ -602,7 +602,7 @@ // disable the use of evalTo for dense objects with a nice compilation error template <typename Dest> EIGEN_DEVICE_FUNC inline void evalTo(Dest&) const { - EIGEN_STATIC_ASSERT((internal::is_same<Dest, void>::value), + EIGEN_STATIC_ASSERT((std::is_same<Dest, void>::value), THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS); }
diff --git a/Eigen/src/Core/DenseCoeffsBase.h b/Eigen/src/Core/DenseCoeffsBase.h index be420c3..d833fbc 100644 --- a/Eigen/src/Core/DenseCoeffsBase.h +++ b/Eigen/src/Core/DenseCoeffsBase.h
@@ -557,25 +557,17 @@ return internal::first_aligned<int(unpacket_traits<DefaultPacketType>::alignment), Derived>(m); } -template <typename Derived, bool HasDirectAccess = has_direct_access<Derived>::ret> -struct inner_stride_at_compile_time { - enum { ret = traits<Derived>::InnerStrideAtCompileTime }; -}; +template <typename Derived, bool HasDirectAccess = has_direct_access<Derived>::value> +struct inner_stride_at_compile_time : std::integral_constant<int, traits<Derived>::InnerStrideAtCompileTime> {}; template <typename Derived> -struct inner_stride_at_compile_time<Derived, false> { - enum { ret = 0 }; -}; +struct inner_stride_at_compile_time<Derived, false> : std::integral_constant<int, 0> {}; -template <typename Derived, bool HasDirectAccess = has_direct_access<Derived>::ret> -struct outer_stride_at_compile_time { - enum { ret = traits<Derived>::OuterStrideAtCompileTime }; -}; +template <typename Derived, bool HasDirectAccess = has_direct_access<Derived>::value> +struct outer_stride_at_compile_time : std::integral_constant<int, traits<Derived>::OuterStrideAtCompileTime> {}; template <typename Derived> -struct outer_stride_at_compile_time<Derived, false> { - enum { ret = 0 }; -}; +struct outer_stride_at_compile_time<Derived, false> : std::integral_constant<int, 0> {}; } // end namespace internal
diff --git a/Eigen/src/Core/Diagonal.h b/Eigen/src/Core/Diagonal.h index 6eafeb7..8024307 100644 --- a/Eigen/src/Core/Diagonal.h +++ b/Eigen/src/Core/Diagonal.h
@@ -58,7 +58,7 @@ MaskLvalueBit = is_lvalue<MatrixType>::value ? LvalueBit : 0, Flags = (unsigned int)MatrixTypeNested_::Flags & (RowMajorBit | MaskLvalueBit | DirectAccessBit) & ~RowMajorBit, // FIXME DirectAccessBit should not be handled by expressions - MatrixTypeOuterStride = outer_stride_at_compile_time<MatrixType>::ret, + MatrixTypeOuterStride = outer_stride_at_compile_time<MatrixType>::value, InnerStrideAtCompileTime = MatrixTypeOuterStride == Dynamic ? Dynamic : MatrixTypeOuterStride + 1, OuterStrideAtCompileTime = 0 };
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index e88b7e3..17e0f78 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h
@@ -73,7 +73,7 @@ typedef product_type_selector<rows_select, cols_select, depth_select> selector; public: - enum { value = selector::ret, ret = selector::ret }; + static constexpr int value = selector::value; #ifdef EIGEN_DEBUG_PRODUCT static void debug() { EIGEN_DEBUG_VAR(Rows); @@ -92,101 +92,53 @@ * This is a compile time mapping from {1,Small,Large}^3 -> {product types} */ // FIXME: the current compile-time product-type mapping may not be optimal. template <int M, int N> -struct product_type_selector<M, N, 1> { - enum { ret = OuterProduct }; -}; +struct product_type_selector<M, N, 1> : std::integral_constant<int, OuterProduct> {}; template <int M> -struct product_type_selector<M, 1, 1> { - enum { ret = LazyCoeffBasedProductMode }; -}; +struct product_type_selector<M, 1, 1> : std::integral_constant<int, LazyCoeffBasedProductMode> {}; template <int N> -struct product_type_selector<1, N, 1> { - enum { ret = LazyCoeffBasedProductMode }; -}; +struct product_type_selector<1, N, 1> : std::integral_constant<int, LazyCoeffBasedProductMode> {}; template <int Depth> -struct product_type_selector<1, 1, Depth> { - enum { ret = InnerProduct }; -}; +struct product_type_selector<1, 1, Depth> : std::integral_constant<int, InnerProduct> {}; template <> -struct product_type_selector<1, 1, 1> { - enum { ret = InnerProduct }; -}; +struct product_type_selector<1, 1, 1> : std::integral_constant<int, InnerProduct> {}; template <> -struct product_type_selector<Small, 1, Small> { - enum { ret = CoeffBasedProductMode }; -}; +struct product_type_selector<Small, 1, Small> : std::integral_constant<int, CoeffBasedProductMode> {}; template <> -struct product_type_selector<1, Small, Small> { - enum { ret = CoeffBasedProductMode }; -}; +struct product_type_selector<1, Small, Small> : std::integral_constant<int, CoeffBasedProductMode> {}; template <> -struct product_type_selector<Small, Small, Small> { - enum { ret = CoeffBasedProductMode }; -}; +struct product_type_selector<Small, Small, Small> : std::integral_constant<int, CoeffBasedProductMode> {}; template <> -struct product_type_selector<Small, Small, 1> { - enum { ret = LazyCoeffBasedProductMode }; -}; +struct product_type_selector<Small, Small, 1> : std::integral_constant<int, LazyCoeffBasedProductMode> {}; template <> -struct product_type_selector<Small, Large, 1> { - enum { ret = LazyCoeffBasedProductMode }; -}; +struct product_type_selector<Small, Large, 1> : std::integral_constant<int, LazyCoeffBasedProductMode> {}; template <> -struct product_type_selector<Large, Small, 1> { - enum { ret = LazyCoeffBasedProductMode }; -}; +struct product_type_selector<Large, Small, 1> : std::integral_constant<int, LazyCoeffBasedProductMode> {}; template <> -struct product_type_selector<1, Large, Small> { - enum { ret = CoeffBasedProductMode }; -}; +struct product_type_selector<1, Large, Small> : std::integral_constant<int, CoeffBasedProductMode> {}; template <> -struct product_type_selector<1, Large, Large> { - enum { ret = GemvProduct }; -}; +struct product_type_selector<1, Large, Large> : std::integral_constant<int, GemvProduct> {}; template <> -struct product_type_selector<1, Small, Large> { - enum { ret = CoeffBasedProductMode }; -}; +struct product_type_selector<1, Small, Large> : std::integral_constant<int, CoeffBasedProductMode> {}; template <> -struct product_type_selector<Large, 1, Small> { - enum { ret = CoeffBasedProductMode }; -}; +struct product_type_selector<Large, 1, Small> : std::integral_constant<int, CoeffBasedProductMode> {}; template <> -struct product_type_selector<Large, 1, Large> { - enum { ret = GemvProduct }; -}; +struct product_type_selector<Large, 1, Large> : std::integral_constant<int, GemvProduct> {}; template <> -struct product_type_selector<Small, 1, Large> { - enum { ret = CoeffBasedProductMode }; -}; +struct product_type_selector<Small, 1, Large> : std::integral_constant<int, CoeffBasedProductMode> {}; template <> -struct product_type_selector<Small, Small, Large> { - enum { ret = GemmProduct }; -}; +struct product_type_selector<Small, Small, Large> : std::integral_constant<int, GemmProduct> {}; template <> -struct product_type_selector<Large, Small, Large> { - enum { ret = GemmProduct }; -}; +struct product_type_selector<Large, Small, Large> : std::integral_constant<int, GemmProduct> {}; template <> -struct product_type_selector<Small, Large, Large> { - enum { ret = GemmProduct }; -}; +struct product_type_selector<Small, Large, Large> : std::integral_constant<int, GemmProduct> {}; template <> -struct product_type_selector<Large, Large, Large> { - enum { ret = GemmProduct }; -}; +struct product_type_selector<Large, Large, Large> : std::integral_constant<int, GemmProduct> {}; template <> -struct product_type_selector<Large, Small, Small> { - enum { ret = CoeffBasedProductMode }; -}; +struct product_type_selector<Large, Small, Small> : std::integral_constant<int, CoeffBasedProductMode> {}; template <> -struct product_type_selector<Small, Large, Small> { - enum { ret = CoeffBasedProductMode }; -}; +struct product_type_selector<Small, Large, Small> : std::integral_constant<int, CoeffBasedProductMode> {}; template <> -struct product_type_selector<Large, Large, Small> { - enum { ret = GemmProduct }; -}; +struct product_type_selector<Large, Large, Small> : std::integral_constant<int, GemmProduct> {}; } // end namespace internal
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index 3d1d6f3..3108e87 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h
@@ -156,10 +156,7 @@ * This is used to enable some generic packet implementations. */ template <typename Packet> -struct is_scalar { - using Scalar = typename unpacket_traits<Packet>::type; - enum { value = internal::is_same<Packet, Scalar>::value }; -}; +struct is_scalar : std::is_same<Packet, typename unpacket_traits<Packet>::type> {}; // automatically and succinctly define combinations of pcast<SrcPacket,TgtPacket> when // 1) the packets are the same type, or @@ -167,7 +164,7 @@ // In both of these cases, preinterpret (bit_cast) is equivalent to pcast (static_cast) template <typename SrcPacket, typename TgtPacket, bool Scalar = is_scalar<SrcPacket>::value && is_scalar<TgtPacket>::value> -struct is_degenerate_helper : is_same<SrcPacket, TgtPacket> {}; +struct is_degenerate_helper : std::is_same<SrcPacket, TgtPacket> {}; template <> struct is_degenerate_helper<int8_t, uint8_t, true> : std::true_type {}; template <> @@ -240,7 +237,7 @@ T m_val; }; -template <typename Target, typename Packet, bool IsSame = is_same<Target, Packet>::value> +template <typename Target, typename Packet, bool IsSame = std::is_same<Target, Packet>::value> struct preinterpret_generic; template <typename Target, typename Packet> @@ -352,7 +349,7 @@ /** \internal \returns -a (coeff-wise) */ template <typename Packet> EIGEN_DEVICE_FUNC inline Packet pnegate(const Packet& a) { - EIGEN_STATIC_ASSERT((!is_same<typename unpacket_traits<Packet>::type, bool>::value), + EIGEN_STATIC_ASSERT((!std::is_same<typename unpacket_traits<Packet>::type, bool>::value), NEGATE IS NOT DEFINED FOR BOOLEAN TYPES) return numext::negate(a); } @@ -528,8 +525,8 @@ // For integers or non-trivial scalars, use binary operators. template <typename T> -struct bitwise_helper<T, typename std::enable_if_t<is_scalar<T>::value && - (NumTraits<T>::IsInteger || NumTraits<T>::RequireInitialization)>> +struct bitwise_helper< + T, std::enable_if_t<is_scalar<T>::value && (NumTraits<T>::IsInteger || NumTraits<T>::RequireInitialization)>> : public operator_bitwise_helper<T> {}; /** \internal \returns the bitwise and of \a a and \a b */
diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index fd69956..8484f2b 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h
@@ -126,8 +126,6 @@ * print the matrix \a _m to the output stream \a s using the output format \a fmt */ template <typename Derived> std::ostream& print_matrix(std::ostream& s, const Derived& _m, const IOFormat& fmt) { - using internal::is_same; - if (_m.size() == 0) { s << fmt.matPrefix << fmt.matSuffix; return s; @@ -135,13 +133,14 @@ typename Derived::Nested m = _m; typedef typename Derived::Scalar Scalar; - typedef std::conditional_t<is_same<Scalar, char>::value || is_same<Scalar, unsigned char>::value || - is_same<Scalar, numext::int8_t>::value || is_same<Scalar, numext::uint8_t>::value, + typedef std::conditional_t<std::is_same<Scalar, char>::value || std::is_same<Scalar, unsigned char>::value || + std::is_same<Scalar, numext::int8_t>::value || + std::is_same<Scalar, numext::uint8_t>::value, int, - std::conditional_t<is_same<Scalar, std::complex<char> >::value || - is_same<Scalar, std::complex<unsigned char> >::value || - is_same<Scalar, std::complex<numext::int8_t> >::value || - is_same<Scalar, std::complex<numext::uint8_t> >::value, + std::conditional_t<std::is_same<Scalar, std::complex<char> >::value || + std::is_same<Scalar, std::complex<unsigned char> >::value || + std::is_same<Scalar, std::complex<numext::int8_t> >::value || + std::is_same<Scalar, std::complex<numext::uint8_t> >::value, std::complex<int>, const Scalar&> > PrintType;
diff --git a/Eigen/src/Core/IndexedView.h b/Eigen/src/Core/IndexedView.h index 8f243d2..0f6d83c 100644 --- a/Eigen/src/Core/IndexedView.h +++ b/Eigen/src/Core/IndexedView.h
@@ -37,15 +37,16 @@ OuterIncr = IsRowMajor ? RowIncr : ColIncr, HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor), - XprInnerStride = HasSameStorageOrderAsXprType ? int(inner_stride_at_compile_time<XprType>::ret) - : int(outer_stride_at_compile_time<XprType>::ret), - XprOuterstride = HasSameStorageOrderAsXprType ? int(outer_stride_at_compile_time<XprType>::ret) - : int(inner_stride_at_compile_time<XprType>::ret), + XprInnerStride = HasSameStorageOrderAsXprType ? int(inner_stride_at_compile_time<XprType>::value) + : int(outer_stride_at_compile_time<XprType>::value), + XprOuterstride = HasSameStorageOrderAsXprType ? int(outer_stride_at_compile_time<XprType>::value) + : int(inner_stride_at_compile_time<XprType>::value), InnerSize = XprTypeIsRowMajor ? ColsAtCompileTime : RowsAtCompileTime, IsBlockAlike = InnerIncr == 1 && OuterIncr == 1, - IsInnerPannel = HasSameStorageOrderAsXprType && - is_same<AllRange<InnerSize>, std::conditional_t<XprTypeIsRowMajor, ColIndices, RowIndices>>::value, + IsInnerPannel = + HasSameStorageOrderAsXprType && + std::is_same<AllRange<InnerSize>, std::conditional_t<XprTypeIsRowMajor, ColIndices, RowIndices>>::value, InnerStrideAtCompileTime = InnerIncr < 0 || InnerIncr == DynamicIndex || XprInnerStride == Dynamic || InnerIncr == Undefined
diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 3059e37..5ab3c0a 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h
@@ -20,8 +20,8 @@ // recursively searches for the largest simd type that does not exceed Size, or the smallest if no such type exists template <typename Scalar, int Size, typename Packet = typename packet_traits<Scalar>::type, - bool Stop = - (unpacket_traits<Packet>::size <= Size) || is_same<Packet, typename unpacket_traits<Packet>::half>::value> + bool Stop = (unpacket_traits<Packet>::size <= Size) || + std::is_same<Packet, typename unpacket_traits<Packet>::half>::value> struct find_inner_product_packet_helper; template <typename Scalar, int Size, typename Packet> @@ -222,8 +222,7 @@ template <typename Scalar, bool Conj> struct scalar_inner_product_op< Scalar, - std::enable_if_t<internal::is_same<typename ScalarBinaryOpTraits<Scalar, Scalar>::ReturnType, Scalar>::value, - Scalar>, + std::enable_if_t<std::is_same<typename ScalarBinaryOpTraits<Scalar, Scalar>::ReturnType, Scalar>::value, Scalar>, Conj> { using result_type = Scalar; using conj_helper = conditional_conj<Scalar, Conj>;
diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 31f3622..a3dd09c 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h
@@ -389,8 +389,7 @@ // Casting from S -> Complex<T> leads to an implicit conversion from S to T, // generating warnings on clang. Here we explicitly cast the real component. template <typename OldType, typename NewType> -struct cast_impl<OldType, NewType, - typename std::enable_if_t<!NumTraits<OldType>::IsComplex && NumTraits<NewType>::IsComplex>> { +struct cast_impl<OldType, NewType, std::enable_if_t<!NumTraits<OldType>::IsComplex && NumTraits<NewType>::IsComplex>> { EIGEN_DEVICE_FUNC static inline NewType run(const OldType& x) { typedef typename NumTraits<NewType>::Real NewReal; return static_cast<NewType>(static_cast<NewReal>(x)); @@ -412,9 +411,10 @@ // This seems to be fixed in VS 2019. #if (!EIGEN_COMP_MSVC || EIGEN_COMP_MSVC >= 1920) // std::arg is only defined for types of std::complex, or integer types or float/double/long double -template <typename Scalar, bool HasStdImpl = NumTraits<Scalar>::IsComplex || is_integral<Scalar>::value || - is_same<Scalar, float>::value || is_same<Scalar, double>::value || - is_same<Scalar, long double>::value> +template <typename Scalar, bool HasStdImpl = NumTraits<Scalar>::IsComplex || std::is_integral<Scalar>::value || + std::is_same<Scalar, float>::value || + std::is_same<Scalar, double>::value || + std::is_same<Scalar, long double>::value> struct arg_default_impl; template <typename Scalar> @@ -622,19 +622,18 @@ struct meta_floor_log2 {}; template <unsigned int n, int lower, int upper> -struct meta_floor_log2<n, lower, upper, meta_floor_log2_move_down> { - enum { value = meta_floor_log2<n, lower, meta_floor_log2_selector<n, lower, upper>::middle>::value }; +struct meta_floor_log2<n, lower, upper, meta_floor_log2_move_down> + : std::integral_constant<int, meta_floor_log2<n, lower, meta_floor_log2_selector<n, lower, upper>::middle>::value> { }; template <unsigned int n, int lower, int upper> -struct meta_floor_log2<n, lower, upper, meta_floor_log2_move_up> { - enum { value = meta_floor_log2<n, meta_floor_log2_selector<n, lower, upper>::middle, upper>::value }; +struct meta_floor_log2<n, lower, upper, meta_floor_log2_move_up> + : std::integral_constant<int, meta_floor_log2<n, meta_floor_log2_selector<n, lower, upper>::middle, upper>::value> { }; template <unsigned int n, int lower, int upper> -struct meta_floor_log2<n, lower, upper, meta_floor_log2_terminate> { - enum { value = (n >= ((unsigned int)(1) << (lower + 1))) ? lower + 1 : lower }; -}; +struct meta_floor_log2<n, lower, upper, meta_floor_log2_terminate> + : std::integral_constant<int, (n >= ((unsigned int)(1) << (lower + 1))) ? lower + 1 : lower> {}; template <unsigned int n, int lower, int upper> struct meta_floor_log2<n, lower, upper, meta_floor_log2_bogus> { @@ -943,7 +942,7 @@ template <typename Scalar> struct negate_impl<Scalar, true> { - EIGEN_STATIC_ASSERT((!is_same<Scalar, bool>::value), NEGATE IS NOT DEFINED FOR BOOLEAN TYPES) + EIGEN_STATIC_ASSERT((!std::is_same<Scalar, bool>::value), NEGATE IS NOT DEFINED FOR BOOLEAN TYPES) static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar run(const Scalar& a) { return Scalar(0) - a; } }; @@ -1014,7 +1013,7 @@ #if defined(EIGEN_GPUCC) template <> -struct has_fma<float> : public true_type {}; +struct has_fma<float> : public std::true_type {}; template <> struct fma_impl<float, void> { @@ -1024,7 +1023,7 @@ }; template <> -struct has_fma<double> : public true_type {}; +struct has_fma<double> : public std::true_type {}; template <> struct fma_impl<double, void> {
diff --git a/Eigen/src/Core/NestByValue.h b/Eigen/src/Core/NestByValue.h index 930a4a5..75038e0 100644 --- a/Eigen/src/Core/NestByValue.h +++ b/Eigen/src/Core/NestByValue.h
@@ -40,7 +40,7 @@ class NestByValue : public internal::dense_xpr_base<NestByValue<ExpressionType> >::type { public: typedef typename internal::dense_xpr_base<NestByValue>::type Base; - static constexpr bool HasDirectAccess = internal::has_direct_access<ExpressionType>::ret; + static constexpr bool HasDirectAccess = internal::has_direct_access<ExpressionType>::value; EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h index 0600021..da02f84 100644 --- a/Eigen/src/Core/PlainObjectBase.h +++ b/Eigen/src/Core/PlainObjectBase.h
@@ -751,8 +751,8 @@ template <typename T0, typename T1> EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init2( const Index& val0, const Index& val1, - std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<T0, Index>::value) && - (internal::is_same<T1, Index>::value) && Base::SizeAtCompileTime == 2, + std::enable_if_t<(!std::is_same<Index, Scalar>::value) && (std::is_same<T0, Index>::value) && + (std::is_same<T1, Index>::value) && Base::SizeAtCompileTime == 2, T1>* = 0) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) m_storage.data()[0] = Scalar(val0); @@ -763,11 +763,10 @@ // then the argument is meant to be the size of the object. template <typename T> EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1( - Index size, - std::enable_if_t<(Base::SizeAtCompileTime != 1 || !internal::is_convertible<T, Scalar>::value) && - ((!internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value || - Base::SizeAtCompileTime == Dynamic)), - T>* = 0) { + Index size, std::enable_if_t<(Base::SizeAtCompileTime != 1 || !std::is_convertible<T, Scalar>::value) && + ((!std::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value || + Base::SizeAtCompileTime == Dynamic)), + T>* = 0) { // NOTE MSVC 2008 complains if we directly put bool(NumTraits<T>::IsInteger) as the EIGEN_STATIC_ASSERT argument. const bool is_integer_alike = internal::is_valid_index_type<T>::value; EIGEN_UNUSED_VARIABLE(is_integer_alike); @@ -780,7 +779,7 @@ template <typename T> EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1( const Scalar& val0, - std::enable_if_t<Base::SizeAtCompileTime == 1 && internal::is_convertible<T, Scalar>::value, T>* = 0) { + std::enable_if_t<Base::SizeAtCompileTime == 1 && std::is_convertible<T, Scalar>::value, T>* = 0) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1) m_storage.data()[0] = val0; } @@ -789,10 +788,9 @@ // type match the index type) template <typename T> EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1( - const Index& val0, - std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<Index, T>::value) && - Base::SizeAtCompileTime == 1 && internal::is_convertible<T, Scalar>::value, - T*>* = 0) { + const Index& val0, std::enable_if_t<(!std::is_same<Index, Scalar>::value) && (std::is_same<Index, T>::value) && + Base::SizeAtCompileTime == 1 && std::is_convertible<T, Scalar>::value, + T*>* = 0) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1) m_storage.data()[0] = Scalar(val0); } @@ -837,8 +835,8 @@ EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1( const Scalar& val0, std::enable_if_t<Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 && - internal::is_convertible<T, Scalar>::value && - internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value, + std::is_convertible<T, Scalar>::value && + std::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value, T>* = 0) { Base::setConstant(val0); } @@ -847,10 +845,10 @@ template <typename T> EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void _init1( const Index& val0, - std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<Index, T>::value) && + std::enable_if_t<(!std::is_same<Index, Scalar>::value) && (std::is_same<Index, T>::value) && Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 && - internal::is_convertible<T, Scalar>::value && - internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value, + std::is_convertible<T, Scalar>::value && + std::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value, T*>* = 0) { Base::setConstant(val0); } @@ -866,7 +864,7 @@ */ template <typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void swap(DenseBase<OtherDerived>& other) { - enum {SwapPointers = internal::is_same<Derived, OtherDerived>::value && Base::SizeAtCompileTime == Dynamic}; + enum {SwapPointers = std::is_same<Derived, OtherDerived>::value && Base::SizeAtCompileTime == Dynamic}; internal::matrix_swap_impl<Derived, OtherDerived, bool(SwapPointers)>::run(this->derived(), other.derived()); }
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index be7bb49..faee28d 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h
@@ -33,7 +33,7 @@ typedef typename ScalarBinaryOpTraits<typename traits<LhsCleaned>::Scalar, typename traits<RhsCleaned>::Scalar>::ReturnType Scalar; typedef typename product_promote_storage_type<typename LhsTraits::StorageKind, typename RhsTraits::StorageKind, - internal::product_type<Lhs, Rhs>::ret>::ret StorageKind; + internal::product_type<Lhs, Rhs>::value>::ret StorageKind; typedef typename promote_index_type<typename LhsTraits::StorageIndex, typename RhsTraits::StorageIndex>::type StorageIndex; @@ -200,7 +200,7 @@ : public ProductImpl<Lhs_, Rhs_, Option, typename internal::product_promote_storage_type< typename internal::traits<Lhs_>::StorageKind, typename internal::traits<Rhs_>::StorageKind, - internal::product_type<Lhs_, Rhs_>::ret>::ret> { + internal::product_type<Lhs_, Rhs_>::value>::ret> { public: typedef Lhs_ Lhs; typedef Rhs_ Rhs; @@ -209,7 +209,7 @@ typename ProductImpl<Lhs, Rhs, Option, typename internal::product_promote_storage_type< typename internal::traits<Lhs>::StorageKind, typename internal::traits<Rhs>::StorageKind, - internal::product_type<Lhs, Rhs>::ret>::ret>::Base Base; + internal::product_type<Lhs, Rhs>::value>::ret>::Base Base; EIGEN_GENERIC_PUBLIC_INTERFACE(Product) typedef typename internal::ref_selector<Lhs>::type LhsNested; @@ -245,7 +245,7 @@ namespace internal { -template <typename Lhs, typename Rhs, int Option, int ProductTag = internal::product_type<Lhs, Rhs>::ret> +template <typename Lhs, typename Rhs, int Option, int ProductTag = internal::product_type<Lhs, Rhs>::value> class dense_product_base : public internal::dense_xpr_base<Product<Lhs, Rhs, Option>>::type {}; /** Conversion to scalar for inner-products */
diff --git a/Eigen/src/Core/ProductEvaluators.h b/Eigen/src/Core/ProductEvaluators.h index 751f04e..2730824 100644 --- a/Eigen/src/Core/ProductEvaluators.h +++ b/Eigen/src/Core/ProductEvaluators.h
@@ -257,7 +257,7 @@ // Column major result template <typename Dst, typename Lhs, typename Rhs, typename Func> void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func& func, - const false_type&) { + const std::false_type&) { evaluator<Rhs> rhsEval(rhs); ei_declare_local_nested_eval(Lhs, lhs, Rhs::SizeAtCompileTime, actual_lhs); // FIXME if cols is large enough, then it might be useful to make sure that lhs is sequentially stored @@ -269,7 +269,7 @@ // Row major result template <typename Dst, typename Lhs, typename Rhs, typename Func> void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func& func, - const true_type&) { + const std::true_type&) { evaluator<Lhs> lhsEval(lhs); ei_declare_local_nested_eval(Rhs, rhs, Lhs::SizeAtCompileTime, actual_rhs); // FIXME if rows is large enough, then it might be useful to make sure that rhs is sequentially stored @@ -285,7 +285,7 @@ template <typename Dst, typename Lhs, typename Rhs, typename Func, typename Scalar> void EIGEN_DEVICE_FUNC outer_product_selector_run_small(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func& func, - const Scalar& alpha, const false_type&) { + const Scalar& alpha, const std::false_type&) { evaluator<Rhs> rhsEval(rhs); ei_declare_local_nested_eval(Lhs, lhs, Rhs::SizeAtCompileTime, actual_lhs); const Index rows = dst.rows(); @@ -300,7 +300,7 @@ template <typename Dst, typename Lhs, typename Rhs, typename Func, typename Scalar> void EIGEN_DEVICE_FUNC outer_product_selector_run_small(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func& func, - const Scalar& alpha, const true_type&) { + const Scalar& alpha, const std::true_type&) { evaluator<Lhs> lhsEval(lhs); ei_declare_local_nested_eval(Rhs, rhs, Lhs::SizeAtCompileTime, actual_rhs); const Index rows = dst.rows(); @@ -505,7 +505,7 @@ template <typename Dst, typename LhsT, typename RhsT, typename Func, typename Scalar> static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func& func, const Scalar& s /* == 1 */, - false_type) { + std::false_type) { EIGEN_UNUSED_VARIABLE(s); eigen_internal_assert(numext::is_exactly_one(s)); call_restricted_packet_assignment_no_alias(dst, lhs.lazyProduct(rhs), func); @@ -513,7 +513,8 @@ template <typename Dst, typename LhsT, typename RhsT, typename Func, typename Scalar> static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, - const Func& func, const Scalar& s, true_type) { + const Func& func, const Scalar& s, + std::true_type) { call_restricted_packet_assignment_no_alias(dst, s * lhs.lazyProduct(rhs), func); } }; @@ -603,7 +604,8 @@ static constexpr int RhsAlignment = plain_enum_min(RhsEtorType::Alignment, RhsVecPacketSize* int(sizeof(typename RhsNestedCleaned::Scalar))); - static constexpr bool SameType = is_same<typename LhsNestedCleaned::Scalar, typename RhsNestedCleaned::Scalar>::value; + static constexpr bool SameType = + std::is_same<typename LhsNestedCleaned::Scalar, typename RhsNestedCleaned::Scalar>::value; static constexpr bool CanVectorizeRhs = bool(RhsRowMajor) && (RhsFlags & PacketAccessBit) && (ColsAtCompileTime != 1); static constexpr bool CanVectorizeLhs = (!LhsRowMajor) && (LhsFlags & PacketAccessBit) && (RowsAtCompileTime != 1); @@ -1245,7 +1247,7 @@ ScalarAccessOnDiag_ = !((int(StorageOrder_) == ColMajor && int(ProductOrder) == OnTheLeft) || (int(StorageOrder_) == RowMajor && int(ProductOrder) == OnTheRight)), - SameTypes_ = is_same<typename MatrixType::Scalar, typename DiagonalType::Scalar>::value, + SameTypes_ = std::is_same<typename MatrixType::Scalar, typename DiagonalType::Scalar>::value, // FIXME currently we need same types, but in the future the next rule should be the one // Vectorizable_ = bool(int(MatrixFlags)&PacketAccessBit) && ((!_PacketOnDiag) || (SameTypes_ && // bool(int(DiagFlags)&PacketAccessBit))), @@ -1280,13 +1282,13 @@ protected: template <int LoadMode, typename PacketType> - EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::true_type) const { + EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, std::true_type) const { return internal::pmul(m_matImpl.template packet<LoadMode, PacketType>(row, col), internal::pset1<PacketType>(m_diagImpl.coeff(id))); } template <int LoadMode, typename PacketType> - EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::false_type) const { + EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, std::false_type) const { enum { InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime, DiagonalPacketLoadMode = plain_enum_min( @@ -1300,14 +1302,14 @@ template <int LoadMode, typename PacketType> EIGEN_STRONG_INLINE PacketType packet_segment_impl(Index row, Index col, Index id, Index begin, Index count, - internal::true_type) const { + std::true_type) const { return internal::pmul(m_matImpl.template packetSegment<LoadMode, PacketType>(row, col, begin, count), internal::pset1<PacketType>(m_diagImpl.coeff(id))); } template <int LoadMode, typename PacketType> EIGEN_STRONG_INLINE PacketType packet_segment_impl(Index row, Index col, Index id, Index begin, Index count, - internal::false_type) const { + std::false_type) const { enum { InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime, DiagonalPacketLoadMode = plain_enum_min( @@ -1583,7 +1585,7 @@ const Index n = Side == OnTheLeft ? mat.rows() : mat.cols(); // FIXME we need an is_same for expression that is not sensitive to constness. For instance // is_same_xpr<Block<const Matrix>, Block<Matrix> >::value should be true. - // if(is_same<MatrixTypeCleaned,Dest>::value && extract_data(dst) == extract_data(mat)) + // if(std::is_same<MatrixTypeCleaned,Dest>::value && extract_data(dst) == extract_data(mat)) if (is_same_dense(dst, mat)) { // apply the permutation inplace Matrix<bool, PermutationType::RowsAtCompileTime, 1, 0, PermutationType::MaxRowsAtCompileTime> mask(perm.size());
diff --git a/Eigen/src/Core/RealView.h b/Eigen/src/Core/RealView.h index 9ffc958..c897a46 100644 --- a/Eigen/src/Core/RealView.h +++ b/Eigen/src/Core/RealView.h
@@ -57,8 +57,8 @@ static constexpr int MaxRowsAtCompileTime = double_size(Base::MaxRowsAtCompileTime, !IsRowMajor); static constexpr int MaxColsAtCompileTime = double_size(Base::MaxColsAtCompileTime, IsRowMajor); static constexpr int MaxSizeAtCompileTime = size_at_compile_time(MaxRowsAtCompileTime, MaxColsAtCompileTime); - static constexpr int OuterStrideAtCompileTime = double_size(outer_stride_at_compile_time<Xpr>::ret, true); - static constexpr int InnerStrideAtCompileTime = inner_stride_at_compile_time<Xpr>::ret; + static constexpr int OuterStrideAtCompileTime = double_size(outer_stride_at_compile_time<Xpr>::value, true); + static constexpr int InnerStrideAtCompileTime = inner_stride_at_compile_time<Xpr>::value; }; template <typename Xpr>
diff --git a/Eigen/src/Core/Ref.h b/Eigen/src/Core/Ref.h index d173a53..d2a4647 100644 --- a/Eigen/src/Core/Ref.h +++ b/Eigen/src/Core/Ref.h
@@ -35,7 +35,7 @@ struct match { enum { IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime, - HasDirectAccess = internal::has_direct_access<Derived>::ret, + HasDirectAccess = internal::has_direct_access<Derived>::value, StorageOrderMatch = IsVectorAtCompileTime || ((PlainObjectType::Flags & RowMajorBit) == (Derived::Flags & RowMajorBit)), InnerStrideMatch = int(InnerStrideAtCompileTime) == int(Dynamic) || @@ -52,11 +52,11 @@ AlignmentMatch = (int(traits<PlainObjectType>::Alignment) == int(Unaligned)) || (DerivedAlignment >= int(Alignment)), // FIXME the first condition is not very clear, it should // be replaced by the required alignment - ScalarTypeMatch = internal::is_same<typename PlainObjectType::Scalar, typename Derived::Scalar>::value, + ScalarTypeMatch = std::is_same<typename PlainObjectType::Scalar, typename Derived::Scalar>::value, MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch && ScalarTypeMatch }; - typedef std::conditional_t<MatchAtCompileTime, internal::true_type, internal::false_type> type; + typedef std::conditional_t<MatchAtCompileTime, std::true_type, std::false_type> type; }; }; @@ -361,15 +361,15 @@ protected: template <typename Expression> - EIGEN_DEVICE_FUNC void construct(const Expression& expr, internal::true_type) { + EIGEN_DEVICE_FUNC void construct(const Expression& expr, std::true_type) { // Check if we can use the underlying expr's storage directly, otherwise call the copy version. if (!Base::construct(expr)) { - construct(expr, internal::false_type()); + construct(expr, std::false_type()); } } template <typename Expression> - EIGEN_DEVICE_FUNC void construct(const Expression& expr, internal::false_type) { + EIGEN_DEVICE_FUNC void construct(const Expression& expr, std::false_type) { internal::call_assignment_no_alias(m_object, expr, internal::assign_op<Scalar, Scalar>()); const bool success = Base::construct(m_object); EIGEN_ONLY_USED_FOR_DEBUG(success);
diff --git a/Eigen/src/Core/Replicate.h b/Eigen/src/Core/Replicate.h index 4d0586b..448b612 100644 --- a/Eigen/src/Core/Replicate.h +++ b/Eigen/src/Core/Replicate.h
@@ -74,7 +74,7 @@ template <typename OriginalMatrixType> EIGEN_DEVICE_FUNC constexpr inline explicit Replicate(const OriginalMatrixType& matrix) : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) { - EIGEN_STATIC_ASSERT((internal::is_same<std::remove_const_t<MatrixType>, OriginalMatrixType>::value), + EIGEN_STATIC_ASSERT((std::is_same<std::remove_const_t<MatrixType>, OriginalMatrixType>::value), THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) eigen_assert(RowFactor != Dynamic && ColFactor != Dynamic); } @@ -82,7 +82,7 @@ template <typename OriginalMatrixType> EIGEN_DEVICE_FUNC constexpr inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor) : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) { - EIGEN_STATIC_ASSERT((internal::is_same<std::remove_const_t<MatrixType>, OriginalMatrixType>::value), + EIGEN_STATIC_ASSERT((std::is_same<std::remove_const_t<MatrixType>, OriginalMatrixType>::value), THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) }
diff --git a/Eigen/src/Core/Reshaped.h b/Eigen/src/Core/Reshaped.h index 04f78da..3762103 100644 --- a/Eigen/src/Core/Reshaped.h +++ b/Eigen/src/Core/Reshaped.h
@@ -66,10 +66,11 @@ : XpxStorageOrder, HasSameStorageOrderAsXprType = (ReshapedStorageOrder == XpxStorageOrder), InnerSize = (ReshapedStorageOrder == int(RowMajor)) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), - InnerStrideAtCompileTime = HasSameStorageOrderAsXprType ? int(inner_stride_at_compile_time<XprType>::ret) : Dynamic, + InnerStrideAtCompileTime = + HasSameStorageOrderAsXprType ? int(inner_stride_at_compile_time<XprType>::value) : Dynamic, OuterStrideAtCompileTime = Dynamic, - HasDirectAccess = internal::has_direct_access<XprType>::ret && (Order == int(XpxStorageOrder)) && + HasDirectAccess = internal::has_direct_access<XprType>::value && (Order == int(XpxStorageOrder)) && ((evaluator<XprType>::Flags & LinearAccessBit) == LinearAccessBit), MaskPacketAccessBit = @@ -249,7 +250,7 @@ // MaxColsAtCompileTime = traits<XprType>::MaxColsAtCompileTime, // // InnerStrideAtCompileTime = traits<XprType>::HasSameStorageOrderAsXprType - // ? int(inner_stride_at_compile_time<ArgType>::ret) + // ? int(inner_stride_at_compile_time<ArgType>::value) // : Dynamic, // OuterStrideAtCompileTime = Dynamic,
diff --git a/Eigen/src/Core/SolverBase.h b/Eigen/src/Core/SolverBase.h index 5f5dc6e..5a7603b 100644 --- a/Eigen/src/Core/SolverBase.h +++ b/Eigen/src/Core/SolverBase.h
@@ -90,7 +90,7 @@ enum { RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime, ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime, - SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::ret), + SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::value), MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime, MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime, MaxSizeAtCompileTime = internal::size_at_compile_time(internal::traits<Derived>::MaxRowsAtCompileTime,
diff --git a/Eigen/src/Core/StlIterators.h b/Eigen/src/Core/StlIterators.h index a23e9e5..751a6ae 100644 --- a/Eigen/src/Core/StlIterators.h +++ b/Eigen/src/Core/StlIterators.h
@@ -28,7 +28,7 @@ typedef typename traits::XprType XprType; typedef indexed_based_stl_iterator_base<typename traits::non_const_iterator> non_const_iterator; typedef indexed_based_stl_iterator_base<typename traits::const_iterator> const_iterator; - typedef std::conditional_t<internal::is_const<XprType>::value, non_const_iterator, const_iterator> other_iterator; + typedef std::conditional_t<std::is_const<XprType>::value, non_const_iterator, const_iterator> other_iterator; friend class indexed_based_stl_iterator_base<typename traits::const_iterator>; friend class indexed_based_stl_iterator_base<typename traits::non_const_iterator>; @@ -174,7 +174,7 @@ typedef typename traits::XprType XprType; typedef indexed_based_stl_reverse_iterator_base<typename traits::non_const_iterator> non_const_iterator; typedef indexed_based_stl_reverse_iterator_base<typename traits::const_iterator> const_iterator; - typedef std::conditional_t<internal::is_const<XprType>::value, non_const_iterator, const_iterator> other_iterator; + typedef std::conditional_t<std::is_const<XprType>::value, non_const_iterator, const_iterator> other_iterator; friend class indexed_based_stl_reverse_iterator_base<typename traits::const_iterator>; friend class indexed_based_stl_reverse_iterator_base<typename traits::non_const_iterator>; @@ -318,7 +318,7 @@ enum { is_lvalue = internal::is_lvalue<XprType>::value }; typedef pointer_based_stl_iterator<std::remove_const_t<XprType>> non_const_iterator; typedef pointer_based_stl_iterator<std::add_const_t<XprType>> const_iterator; - typedef std::conditional_t<internal::is_const<XprType>::value, non_const_iterator, const_iterator> other_iterator; + typedef std::conditional_t<std::is_const<XprType>::value, non_const_iterator, const_iterator> other_iterator; friend class pointer_based_stl_iterator<std::add_const_t<XprType>>; friend class pointer_based_stl_iterator<std::remove_const_t<XprType>>;
diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 06cd046..e8f483c 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h
@@ -31,8 +31,8 @@ Flags0 = traits<MatrixTypeNestedPlain>::Flags & ~(LvalueBit | NestByRefBit), Flags1 = Flags0 | FlagsLvalueBit, Flags = Flags1 ^ RowMajorBit, - InnerStrideAtCompileTime = inner_stride_at_compile_time<MatrixType>::ret, - OuterStrideAtCompileTime = outer_stride_at_compile_time<MatrixType>::ret + InnerStrideAtCompileTime = inner_stride_at_compile_time<MatrixType>::value, + OuterStrideAtCompileTime = outer_stride_at_compile_time<MatrixType>::value }; }; } // namespace internal @@ -89,7 +89,7 @@ namespace internal { -template <typename MatrixType, bool HasDirectAccess = has_direct_access<MatrixType>::ret> +template <typename MatrixType, bool HasDirectAccess = has_direct_access<MatrixType>::value> struct TransposeImpl_base { typedef typename dense_xpr_base<Transpose<MatrixType> >::type type; }; @@ -360,17 +360,13 @@ namespace internal { template <bool DestIsTransposed, typename OtherDerived> -struct check_transpose_aliasing_compile_time_selector { - enum { ret = bool(blas_traits<OtherDerived>::IsTransposed) != DestIsTransposed }; -}; +struct check_transpose_aliasing_compile_time_selector + : std::integral_constant<bool, bool(blas_traits<OtherDerived>::IsTransposed) != DestIsTransposed> {}; template <bool DestIsTransposed, typename BinOp, typename DerivedA, typename DerivedB> -struct check_transpose_aliasing_compile_time_selector<DestIsTransposed, CwiseBinaryOp<BinOp, DerivedA, DerivedB> > { - enum { - ret = bool(blas_traits<DerivedA>::IsTransposed) != DestIsTransposed || - bool(blas_traits<DerivedB>::IsTransposed) != DestIsTransposed - }; -}; +struct check_transpose_aliasing_compile_time_selector<DestIsTransposed, CwiseBinaryOp<BinOp, DerivedA, DerivedB> > + : std::integral_constant<bool, bool(blas_traits<DerivedA>::IsTransposed) != DestIsTransposed || + bool(blas_traits<DerivedB>::IsTransposed) != DestIsTransposed> {}; template <typename Scalar, bool DestIsTransposed, typename OtherDerived> struct check_transpose_aliasing_run_time_selector { @@ -398,7 +394,7 @@ template <typename Derived, typename OtherDerived, bool MightHaveTransposeAliasing = - check_transpose_aliasing_compile_time_selector<blas_traits<Derived>::IsTransposed, OtherDerived>::ret> + check_transpose_aliasing_compile_time_selector<blas_traits<Derived>::IsTransposed, OtherDerived>::value> struct checkTransposeAliasing_impl { EIGEN_DEVICE_FUNC static void run(const Derived& dst, const OtherDerived& other) { eigen_assert(
diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index f4048b8..065323d 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h
@@ -76,7 +76,7 @@ MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime, MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime, - SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::ret), + SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::value), /**< This is equal to the number of coefficients, i.e. the number of * rows times the number of columns, or to \a Dynamic if this is not * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index 93be722..b65dbeb 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h
@@ -86,9 +86,7 @@ typedef ResultType result_type; \ typedef BINARYOP<Scalar, Scalar> BinaryOp; \ template <int Size> \ - struct Cost { \ - enum { value = COST }; \ - }; \ + struct Cost : std::integral_constant<int, COST> {}; \ enum { Vectorizable = VECTORIZABLE }; \ template <typename XprType> \ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType operator()(const XprType& mat) const { \ @@ -119,8 +117,8 @@ typedef ResultType result_type; enum { Vectorizable = 0 }; template <int Size> - struct Cost { - enum { value = (Size + 5) * NumTraits<Scalar>::MulCost + (Size - 1) * NumTraits<Scalar>::AddCost }; + struct Cost + : std::integral_constant<int, (Size + 5) * NumTraits<Scalar>::MulCost + (Size - 1) * NumTraits<Scalar>::AddCost> { }; EIGEN_DEVICE_FUNC member_lpnorm() {} template <typename XprType> @@ -136,9 +134,7 @@ enum { Vectorizable = functor_traits<BinaryOp>::PacketAccess }; template <int Size> - struct Cost { - enum { value = (Size - 1) * functor_traits<BinaryOp>::Cost }; - }; + struct Cost : std::integral_constant<int, (Size - 1) * functor_traits<BinaryOp>::Cost> {}; EIGEN_DEVICE_FUNC explicit member_redux(const BinaryOp func) : m_functor(func) {} template <typename Derived> EIGEN_DEVICE_FUNC inline result_type operator()(const DenseBase<Derived>& mat) const {
diff --git a/Eigen/src/Core/Visitor.h b/Eigen/src/Core/Visitor.h index fe64f30..99522bd 100644 --- a/Eigen/src/Core/Visitor.h +++ b/Eigen/src/Core/Visitor.h
@@ -466,7 +466,7 @@ Cost = NumTraits<Scalar>::AddCost, LinearAccess = true, // predux is problematic for bool - PacketAccess = packet_traits<Scalar>::HasCmp && packet_traits<Scalar>::HasAdd && !is_same<Scalar, bool>::value + PacketAccess = packet_traits<Scalar>::HasCmp && packet_traits<Scalar>::HasAdd && !std::is_same<Scalar, bool>::value }; };
diff --git a/Eigen/src/Core/arch/AVX/PacketMath.h b/Eigen/src/Core/arch/AVX/PacketMath.h index 7ab3f2d..12be824 100644 --- a/Eigen/src/Core/arch/AVX/PacketMath.h +++ b/Eigen/src/Core/arch/AVX/PacketMath.h
@@ -50,50 +50,32 @@ #define SIGN_MASK_I64 static_cast<int64_t>(0x8000000000000000ULL) template <> -struct is_arithmetic<__m256> { - enum { value = true }; -}; +struct is_arithmetic<__m256> : std::true_type {}; template <> -struct is_arithmetic<__m256i> { - enum { value = true }; -}; +struct is_arithmetic<__m256i> : std::true_type {}; template <> -struct is_arithmetic<__m256d> { - enum { value = true }; -}; +struct is_arithmetic<__m256d> : std::true_type {}; template <> -struct is_arithmetic<Packet8i> { - enum { value = true }; -}; +struct is_arithmetic<Packet8i> : std::true_type {}; // Note that `Packet8ui` uses the underlying type `__m256i`, which is // interpreted as a vector of _signed_ `int32`s, which breaks some arithmetic // operations used in `GenericPacketMath.h`. template <> -struct is_arithmetic<Packet8ui> { - enum { value = false }; -}; +struct is_arithmetic<Packet8ui> : std::false_type {}; #ifndef EIGEN_VECTORIZE_AVX512FP16 template <> -struct is_arithmetic<Packet8h> { - enum { value = true }; -}; +struct is_arithmetic<Packet8h> : std::true_type {}; #endif template <> -struct is_arithmetic<Packet8bf> { - enum { value = true }; -}; +struct is_arithmetic<Packet8bf> : std::true_type {}; #ifdef EIGEN_VECTORIZE_AVX2 template <> -struct is_arithmetic<Packet4l> { - enum { value = true }; -}; +struct is_arithmetic<Packet4l> : std::true_type {}; // Note that `Packet4ul` uses the underlying type `__m256i`, which is // interpreted as a vector of _signed_ `int32`s, which breaks some arithmetic // operations used in `GenericPacketMath.h`. template <> -struct is_arithmetic<Packet4ul> { - enum { value = false }; -}; +struct is_arithmetic<Packet4ul> : std::false_type {}; #endif // Use the packet_traits defined in AVX512/PacketMath.h instead if we're going @@ -303,13 +285,9 @@ #endif template <> -struct scalar_div_cost<float, true> { - enum { value = 14 }; -}; +struct scalar_div_cost<float, true> : std::integral_constant<int, 14> {}; template <> -struct scalar_div_cost<double, true> { - enum { value = 16 }; -}; +struct scalar_div_cost<double, true> : std::integral_constant<int, 16> {}; template <> struct unpacket_traits<Packet8f> {
diff --git a/Eigen/src/Core/arch/AVX512/PacketMath.h b/Eigen/src/Core/arch/AVX512/PacketMath.h index a4efba8..0bc9819 100644 --- a/Eigen/src/Core/arch/AVX512/PacketMath.h +++ b/Eigen/src/Core/arch/AVX512/PacketMath.h
@@ -94,27 +94,17 @@ } template <> -struct is_arithmetic<__m512> { - enum { value = true }; -}; +struct is_arithmetic<__m512> : std::true_type {}; template <> -struct is_arithmetic<__m512i> { - enum { value = true }; -}; +struct is_arithmetic<__m512i> : std::true_type {}; template <> -struct is_arithmetic<__m512d> { - enum { value = true }; -}; +struct is_arithmetic<__m512d> : std::true_type {}; template <> -struct is_arithmetic<Packet8l> { - enum { value = true }; -}; +struct is_arithmetic<Packet8l> : std::true_type {}; #ifndef EIGEN_VECTORIZE_AVX512FP16 template <> -struct is_arithmetic<Packet16h> { - enum { value = true }; -}; +struct is_arithmetic<Packet16h> : std::true_type {}; template <> struct packet_traits<half> : default_packet_traits { @@ -2558,9 +2548,7 @@ #endif // EIGEN_VECTORIZE_AVX512FP16 template <> -struct is_arithmetic<Packet16bf> { - enum { value = true }; -}; +struct is_arithmetic<Packet16bf> : std::true_type {}; template <> struct packet_traits<bfloat16> : default_packet_traits {
diff --git a/Eigen/src/Core/arch/Default/BFloat16.h b/Eigen/src/Core/arch/Default/BFloat16.h index 66f719a..02edcb0 100644 --- a/Eigen/src/Core/arch/Default/BFloat16.h +++ b/Eigen/src/Core/arch/Default/BFloat16.h
@@ -151,7 +151,7 @@ template <class T> explicit EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR bfloat16(T val) : bfloat16_impl::bfloat16_base( - bfloat16_impl::float_to_bfloat16_rtne<internal::is_integral<T>::value>(static_cast<float>(val))) {} + bfloat16_impl::float_to_bfloat16_rtne<std::is_integral<T>::value>(static_cast<float>(val))) {} explicit EIGEN_DEVICE_FUNC bfloat16(float f) : bfloat16_impl::bfloat16_base(bfloat16_impl::float_to_bfloat16_rtne<false>(f)) {} @@ -734,9 +734,7 @@ namespace internal { template <> -struct is_arithmetic<bfloat16> { - enum { value = true }; -}; +struct is_arithmetic<bfloat16> : std::true_type {}; template <> struct random_impl<bfloat16> {
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFrexpLdexp.h b/Eigen/src/Core/arch/Default/GenericPacketMathFrexpLdexp.h index a1607f3..cdf3291 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFrexpLdexp.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFrexpLdexp.h
@@ -51,7 +51,7 @@ template <typename Packet> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Packet pfrexp_generic(const Packet& a, Packet& exponent) { typedef typename unpacket_traits<Packet>::type Scalar; - typedef typename make_unsigned<typename make_integer<Scalar>::type>::type ScalarUI; + typedef std::make_unsigned_t<typename make_integer<Scalar>::type> ScalarUI; static constexpr int TotalBits = sizeof(Scalar) * CHAR_BIT, MantissaBits = numext::numeric_limits<Scalar>::digits - 1, ExponentBits = TotalBits - MantissaBits - 1;
diff --git a/Eigen/src/Core/arch/Default/Half.h b/Eigen/src/Core/arch/Default/Half.h index 99e2f2f..f102c83 100644 --- a/Eigen/src/Core/arch/Default/Half.h +++ b/Eigen/src/Core/arch/Default/Half.h
@@ -880,9 +880,7 @@ namespace internal { template <> -struct is_arithmetic<half> { - enum { value = true }; -}; +struct is_arithmetic<half> : std::true_type {}; template <> struct random_impl<half> {
diff --git a/Eigen/src/Core/arch/GPU/PacketMath.h b/Eigen/src/Core/arch/GPU/PacketMath.h index 4a4703a..31364a7 100644 --- a/Eigen/src/Core/arch/GPU/PacketMath.h +++ b/Eigen/src/Core/arch/GPU/PacketMath.h
@@ -36,13 +36,9 @@ #if defined(EIGEN_GPUCC) && defined(EIGEN_USE_GPU) template <> -struct is_arithmetic<float4> { - enum { value = true }; -}; +struct is_arithmetic<float4> : std::true_type {}; template <> -struct is_arithmetic<double2> { - enum { value = true }; -}; +struct is_arithmetic<double2> : std::true_type {}; template <> struct packet_traits<float> : default_packet_traits { @@ -589,9 +585,7 @@ using half = Packet4h2; }; template <> -struct is_arithmetic<Packet4h2> { - enum { value = true }; -}; +struct is_arithmetic<Packet4h2> : std::true_type {}; template <> struct unpacket_traits<half2> { @@ -604,9 +598,7 @@ using half = half2; }; template <> -struct is_arithmetic<half2> { - enum { value = true }; -}; +struct is_arithmetic<half2> : std::true_type {}; template <> struct packet_traits<Eigen::half> : default_packet_traits {
diff --git a/Eigen/src/Core/arch/LSX/PacketMath.h b/Eigen/src/Core/arch/LSX/PacketMath.h index c4d3610..5f35515 100644 --- a/Eigen/src/Core/arch/LSX/PacketMath.h +++ b/Eigen/src/Core/arch/LSX/PacketMath.h
@@ -46,49 +46,27 @@ typedef eigen_packet_wrapper<__m128i, 7> Packet2ul; template <> -struct is_arithmetic<__m128> { - enum { value = true }; -}; +struct is_arithmetic<__m128> : std::true_type {}; template <> -struct is_arithmetic<__m128i> { - enum { value = true }; -}; +struct is_arithmetic<__m128i> : std::true_type {}; template <> -struct is_arithmetic<__m128d> { - enum { value = true }; -}; +struct is_arithmetic<__m128d> : std::true_type {}; template <> -struct is_arithmetic<Packet16c> { - enum { value = true }; -}; +struct is_arithmetic<Packet16c> : std::true_type {}; template <> -struct is_arithmetic<Packet8s> { - enum { value = true }; -}; +struct is_arithmetic<Packet8s> : std::true_type {}; template <> -struct is_arithmetic<Packet4i> { - enum { value = true }; -}; +struct is_arithmetic<Packet4i> : std::true_type {}; template <> -struct is_arithmetic<Packet2l> { - enum { value = true }; -}; +struct is_arithmetic<Packet2l> : std::true_type {}; template <> -struct is_arithmetic<Packet16uc> { - enum { value = false }; -}; +struct is_arithmetic<Packet16uc> : std::false_type {}; template <> -struct is_arithmetic<Packet8us> { - enum { value = false }; -}; +struct is_arithmetic<Packet8us> : std::false_type {}; template <> -struct is_arithmetic<Packet4ui> { - enum { value = false }; -}; +struct is_arithmetic<Packet4ui> : std::false_type {}; template <> -struct is_arithmetic<Packet2ul> { - enum { value = false }; -}; +struct is_arithmetic<Packet2ul> : std::false_type {}; EIGEN_ALWAYS_INLINE Packet4f make_packet4f(float a, float b, float c, float d) { float from[4] = {a, b, c, d};
diff --git a/Eigen/src/Core/arch/NEON/PacketMath.h b/Eigen/src/Core/arch/NEON/PacketMath.h index f030988..dad7c14 100644 --- a/Eigen/src/Core/arch/NEON/PacketMath.h +++ b/Eigen/src/Core/arch/NEON/PacketMath.h
@@ -4631,9 +4631,7 @@ typedef eigen_packet_wrapper<uint16x4_t, 19> Packet4bf; template <> -struct is_arithmetic<Packet4bf> { - enum { value = true }; -}; +struct is_arithmetic<Packet4bf> : std::true_type {}; template <> struct packet_traits<bfloat16> : default_packet_traits {
diff --git a/Eigen/src/Core/arch/SSE/PacketMath.h b/Eigen/src/Core/arch/SSE/PacketMath.h index 93e105d..5d0d46b 100644 --- a/Eigen/src/Core/arch/SSE/PacketMath.h +++ b/Eigen/src/Core/arch/SSE/PacketMath.h
@@ -56,36 +56,22 @@ typedef eigen_packet_wrapper<__m128i, 5> Packet2l; template <> -struct is_arithmetic<__m128> { - enum { value = true }; -}; +struct is_arithmetic<__m128> : std::true_type {}; template <> -struct is_arithmetic<__m128i> { - enum { value = true }; -}; +struct is_arithmetic<__m128i> : std::true_type {}; template <> -struct is_arithmetic<__m128d> { - enum { value = true }; -}; +struct is_arithmetic<__m128d> : std::true_type {}; template <> -struct is_arithmetic<Packet4i> { - enum { value = true }; -}; +struct is_arithmetic<Packet4i> : std::true_type {}; template <> -struct is_arithmetic<Packet2l> { - enum { value = true }; -}; +struct is_arithmetic<Packet2l> : std::true_type {}; // Note that `Packet4ui` uses the underlying type `__m128i`, which is // interpreted as a vector of _signed_ `int32`s, which breaks some arithmetic // operations used in `GenericPacketMath.h`. template <> -struct is_arithmetic<Packet4ui> { - enum { value = false }; -}; +struct is_arithmetic<Packet4ui> : std::false_type {}; template <> -struct is_arithmetic<Packet16b> { - enum { value = true }; -}; +struct is_arithmetic<Packet16b> : std::true_type {}; template <int p, int q, int r, int s> struct shuffle_mask { @@ -386,13 +372,9 @@ #ifndef EIGEN_VECTORIZE_AVX template <> -struct scalar_div_cost<float, true> { - enum { value = 7 }; -}; +struct scalar_div_cost<float, true> : std::integral_constant<int, 7> {}; template <> -struct scalar_div_cost<double, true> { - enum { value = 8 }; -}; +struct scalar_div_cost<double, true> : std::integral_constant<int, 8> {}; #endif template <>
diff --git a/Eigen/src/Core/arch/SYCL/InteropHeaders.h b/Eigen/src/Core/arch/SYCL/InteropHeaders.h index 15eaa0c..d051073 100644 --- a/Eigen/src/Core/arch/SYCL/InteropHeaders.h +++ b/Eigen/src/Core/arch/SYCL/InteropHeaders.h
@@ -97,11 +97,9 @@ // Make sure this is only available when targeting a GPU: we don't want to // introduce conflicts between these packet_traits definitions and the ones // we'll use on the host side (SSE, AVX, ...) -#define SYCL_ARITHMETIC(packet_type) \ - template <> \ - struct is_arithmetic<packet_type> { \ - enum { value = true }; \ - }; +#define SYCL_ARITHMETIC(packet_type) \ + template <> \ + struct is_arithmetic<packet_type> : std::true_type {}; SYCL_ARITHMETIC(cl::sycl::cl_half8) SYCL_ARITHMETIC(cl::sycl::cl_float4) SYCL_ARITHMETIC(cl::sycl::cl_double2)
diff --git a/Eigen/src/Core/functors/AssignmentFunctors.h b/Eigen/src/Core/functors/AssignmentFunctors.h index d811b27..1434c7e 100644 --- a/Eigen/src/Core/functors/AssignmentFunctors.h +++ b/Eigen/src/Core/functors/AssignmentFunctors.h
@@ -45,7 +45,7 @@ struct functor_traits<assign_op<DstScalar, SrcScalar>> { enum { Cost = NumTraits<DstScalar>::ReadCost, - PacketAccess = is_same<DstScalar, SrcScalar>::value && packet_traits<DstScalar>::Vectorizable && + PacketAccess = std::is_same<DstScalar, SrcScalar>::value && packet_traits<DstScalar>::Vectorizable && packet_traits<SrcScalar>::Vectorizable }; };
diff --git a/Eigen/src/Core/functors/BinaryFunctors.h b/Eigen/src/Core/functors/BinaryFunctors.h index 7d66073..ff5a23c 100644 --- a/Eigen/src/Core/functors/BinaryFunctors.h +++ b/Eigen/src/Core/functors/BinaryFunctors.h
@@ -54,8 +54,8 @@ struct functor_traits<scalar_sum_op<LhsScalar, RhsScalar>> { enum { Cost = (int(NumTraits<LhsScalar>::AddCost) + int(NumTraits<RhsScalar>::AddCost)) / 2, // rough estimate! - PacketAccess = - is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasAdd && packet_traits<RhsScalar>::HasAdd + PacketAccess = std::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasAdd && + packet_traits<RhsScalar>::HasAdd // TODO: vectorize mixed sum }; }; @@ -94,8 +94,8 @@ struct functor_traits<scalar_product_op<LhsScalar, RhsScalar>> { enum { Cost = (int(NumTraits<LhsScalar>::MulCost) + int(NumTraits<RhsScalar>::MulCost)) / 2, // rough estimate! - PacketAccess = - is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasMul && packet_traits<RhsScalar>::HasMul + PacketAccess = std::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasMul && + packet_traits<RhsScalar>::HasMul // TODO: vectorize mixed product }; }; @@ -131,7 +131,7 @@ struct functor_traits<scalar_conj_product_op<LhsScalar, RhsScalar>> { enum { Cost = NumTraits<LhsScalar>::MulCost, - PacketAccess = internal::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasMul + PacketAccess = std::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasMul }; }; @@ -160,7 +160,7 @@ struct functor_traits<scalar_min_op<LhsScalar, RhsScalar, NaNPropagation>> { enum { Cost = (NumTraits<LhsScalar>::AddCost + NumTraits<RhsScalar>::AddCost) / 2, - PacketAccess = internal::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasMin + PacketAccess = std::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasMin }; }; @@ -189,7 +189,7 @@ struct functor_traits<scalar_max_op<LhsScalar, RhsScalar, NaNPropagation>> { enum { Cost = (NumTraits<LhsScalar>::AddCost + NumTraits<RhsScalar>::AddCost) / 2, - PacketAccess = internal::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasMax + PacketAccess = std::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasMax }; }; @@ -204,8 +204,8 @@ struct functor_traits<scalar_cmp_op<LhsScalar, RhsScalar, cmp, UseTypedComparators>> { enum { Cost = (NumTraits<LhsScalar>::AddCost + NumTraits<RhsScalar>::AddCost) / 2, - PacketAccess = (UseTypedComparators || is_same<LhsScalar, bool>::value) && is_same<LhsScalar, RhsScalar>::value && - packet_traits<LhsScalar>::HasCmp + PacketAccess = (UseTypedComparators || std::is_same<LhsScalar, bool>::value) && + std::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasCmp }; }; @@ -383,8 +383,8 @@ struct functor_traits<scalar_difference_op<LhsScalar, RhsScalar>> { enum { Cost = (int(NumTraits<LhsScalar>::AddCost) + int(NumTraits<RhsScalar>::AddCost)) / 2, - PacketAccess = - is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasSub && packet_traits<RhsScalar>::HasSub + PacketAccess = std::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasSub && + packet_traits<RhsScalar>::HasSub }; }; @@ -432,8 +432,8 @@ struct functor_traits<scalar_quotient_op<LhsScalar, RhsScalar>> { typedef typename scalar_quotient_op<LhsScalar, RhsScalar>::result_type result_type; enum { - PacketAccess = - is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasDiv && packet_traits<RhsScalar>::HasDiv, + PacketAccess = std::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasDiv && + packet_traits<RhsScalar>::HasDiv, Cost = scalar_div_cost<result_type, PacketAccess>::value }; }; @@ -574,7 +574,7 @@ struct scalar_bitwise_and_op { EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::RequireInitialization, BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES) - EIGEN_STATIC_ASSERT((!internal::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES) + EIGEN_STATIC_ASSERT((!std::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES) using result_type = Scalar; EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar operator()(const Scalar& a, const Scalar& b) const { return bitwise_binary_impl<Scalar>::run_and(a, b); @@ -598,7 +598,7 @@ struct scalar_bitwise_or_op { EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::RequireInitialization, BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES) - EIGEN_STATIC_ASSERT((!internal::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES) + EIGEN_STATIC_ASSERT((!std::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES) using result_type = Scalar; EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar operator()(const Scalar& a, const Scalar& b) const { return bitwise_binary_impl<Scalar>::run_or(a, b); @@ -622,7 +622,7 @@ struct scalar_bitwise_xor_op { EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::RequireInitialization, BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES) - EIGEN_STATIC_ASSERT((!internal::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES) + EIGEN_STATIC_ASSERT((!std::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES) using result_type = Scalar; EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar operator()(const Scalar& a, const Scalar& b) const { return bitwise_binary_impl<Scalar>::run_xor(a, b); @@ -661,7 +661,7 @@ struct functor_traits<scalar_absolute_difference_op<LhsScalar, RhsScalar>> { enum { Cost = (NumTraits<LhsScalar>::AddCost + NumTraits<RhsScalar>::AddCost) / 2, - PacketAccess = is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasAbsDiff + PacketAccess = std::is_same<LhsScalar, RhsScalar>::value && packet_traits<LhsScalar>::HasAbsDiff }; }; @@ -670,7 +670,7 @@ using Scalar = LhsScalar; static constexpr bool Enable = - is_same<LhsScalar, RhsScalar>::value && !NumTraits<Scalar>::IsInteger && !NumTraits<Scalar>::IsComplex; + std::is_same<LhsScalar, RhsScalar>::value && !NumTraits<Scalar>::IsInteger && !NumTraits<Scalar>::IsComplex; EIGEN_STATIC_ASSERT(Enable, "LhsScalar and RhsScalar must be the same non-integer, non-complex type") EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar operator()(const Scalar& y, const Scalar& x) const { @@ -686,7 +686,7 @@ struct functor_traits<scalar_atan2_op<LhsScalar, RhsScalar>> { using Scalar = LhsScalar; enum { - PacketAccess = is_same<LhsScalar, RhsScalar>::value && packet_traits<Scalar>::HasATan && + PacketAccess = std::is_same<LhsScalar, RhsScalar>::value && packet_traits<Scalar>::HasATan && packet_traits<Scalar>::HasDiv && !NumTraits<Scalar>::IsInteger && !NumTraits<Scalar>::IsComplex, Cost = int(scalar_div_cost<Scalar, PacketAccess>::value) + int(functor_traits<scalar_atan_op<Scalar>>::Cost) };
diff --git a/Eigen/src/Core/functors/NullaryFunctors.h b/Eigen/src/Core/functors/NullaryFunctors.h index 8f76d5b..eb47afc 100644 --- a/Eigen/src/Core/functors/NullaryFunctors.h +++ b/Eigen/src/Core/functors/NullaryFunctors.h
@@ -208,64 +208,38 @@ // and linear access is not possible. In all other cases, linear access is enabled. // Users should not have to deal with this structure. template <typename Functor> -struct functor_has_linear_access { - enum { ret = !has_binary_operator<Functor>::value }; -}; +struct functor_has_linear_access : std::integral_constant<bool, !has_binary_operator<Functor>::value> {}; // For unreliable compilers, let's specialize the has_*ary_operator // helpers so that at least built-in nullary functors work fine. #if !(EIGEN_COMP_MSVC || EIGEN_COMP_GNUC || (EIGEN_COMP_ICC >= 1600)) template <typename Scalar, typename IndexType> -struct has_nullary_operator<scalar_constant_op<Scalar>, IndexType> { - enum { value = 1 }; -}; +struct has_nullary_operator<scalar_constant_op<Scalar>, IndexType> : std::true_type {}; template <typename Scalar, typename IndexType> -struct has_unary_operator<scalar_constant_op<Scalar>, IndexType> { - enum { value = 0 }; -}; +struct has_unary_operator<scalar_constant_op<Scalar>, IndexType> : std::false_type {}; template <typename Scalar, typename IndexType> -struct has_binary_operator<scalar_constant_op<Scalar>, IndexType> { - enum { value = 0 }; -}; +struct has_binary_operator<scalar_constant_op<Scalar>, IndexType> : std::false_type {}; template <typename Scalar, typename IndexType> -struct has_nullary_operator<scalar_identity_op<Scalar>, IndexType> { - enum { value = 0 }; -}; +struct has_nullary_operator<scalar_identity_op<Scalar>, IndexType> : std::false_type {}; template <typename Scalar, typename IndexType> -struct has_unary_operator<scalar_identity_op<Scalar>, IndexType> { - enum { value = 0 }; -}; +struct has_unary_operator<scalar_identity_op<Scalar>, IndexType> : std::false_type {}; template <typename Scalar, typename IndexType> -struct has_binary_operator<scalar_identity_op<Scalar>, IndexType> { - enum { value = 1 }; -}; +struct has_binary_operator<scalar_identity_op<Scalar>, IndexType> : std::true_type {}; template <typename Scalar, typename IndexType> -struct has_nullary_operator<linspaced_op<Scalar>, IndexType> { - enum { value = 0 }; -}; +struct has_nullary_operator<linspaced_op<Scalar>, IndexType> : std::false_type {}; template <typename Scalar, typename IndexType> -struct has_unary_operator<linspaced_op<Scalar>, IndexType> { - enum { value = 1 }; -}; +struct has_unary_operator<linspaced_op<Scalar>, IndexType> : std::true_type {}; template <typename Scalar, typename IndexType> -struct has_binary_operator<linspaced_op<Scalar>, IndexType> { - enum { value = 0 }; -}; +struct has_binary_operator<linspaced_op<Scalar>, IndexType> : std::false_type {}; template <typename Scalar, typename IndexType> -struct has_nullary_operator<scalar_random_op<Scalar>, IndexType> { - enum { value = 1 }; -}; +struct has_nullary_operator<scalar_random_op<Scalar>, IndexType> : std::true_type {}; template <typename Scalar, typename IndexType> -struct has_unary_operator<scalar_random_op<Scalar>, IndexType> { - enum { value = 0 }; -}; +struct has_unary_operator<scalar_random_op<Scalar>, IndexType> : std::false_type {}; template <typename Scalar, typename IndexType> -struct has_binary_operator<scalar_random_op<Scalar>, IndexType> { - enum { value = 0 }; -}; +struct has_binary_operator<scalar_random_op<Scalar>, IndexType> : std::false_type {}; #endif } // end namespace internal
diff --git a/Eigen/src/Core/functors/TernaryFunctors.h b/Eigen/src/Core/functors/TernaryFunctors.h index 598549e..a53eec8 100644 --- a/Eigen/src/Core/functors/TernaryFunctors.h +++ b/Eigen/src/Core/functors/TernaryFunctors.h
@@ -23,7 +23,7 @@ template <typename ThenScalar, typename ElseScalar, typename ConditionScalar> struct scalar_boolean_select_op { static constexpr bool ThenElseAreSame = - is_same<std::remove_const_t<ThenScalar>, std::remove_const_t<ElseScalar>>::value; + std::is_same<std::remove_const_t<ThenScalar>, std::remove_const_t<ElseScalar>>::value; EIGEN_STATIC_ASSERT(ThenElseAreSame, THEN AND ELSE MUST BE SAME TYPE) using Scalar = ThenScalar; using result_type = Scalar; @@ -42,7 +42,7 @@ using Scalar = ThenScalar; enum { Cost = 1, - PacketAccess = is_same<ThenScalar, ElseScalar>::value && is_same<ConditionScalar, Scalar>::value && + PacketAccess = std::is_same<ThenScalar, ElseScalar>::value && std::is_same<ConditionScalar, Scalar>::value && packet_traits<Scalar>::HasCmp }; };
diff --git a/Eigen/src/Core/functors/UnaryFunctors.h b/Eigen/src/Core/functors/UnaryFunctors.h index 3bfb493..ea5fff5 100644 --- a/Eigen/src/Core/functors/UnaryFunctors.h +++ b/Eigen/src/Core/functors/UnaryFunctors.h
@@ -201,7 +201,7 @@ template <typename Scalar, typename NewType> struct functor_traits<scalar_cast_op<Scalar, NewType>> { - enum { Cost = is_same<Scalar, NewType>::value ? 0 : NumTraits<NewType>::AddCost, PacketAccess = false }; + enum { Cost = std::is_same<Scalar, NewType>::value ? 0 : NumTraits<NewType>::AddCost, PacketAccess = false }; }; /** \internal @@ -217,7 +217,7 @@ struct functor_traits<core_cast_op<SrcType, DstType>> { using CastingTraits = type_casting_traits<SrcType, DstType>; enum { - Cost = is_same<SrcType, DstType>::value ? 0 : NumTraits<DstType>::AddCost, + Cost = std::is_same<SrcType, DstType>::value ? 0 : NumTraits<DstType>::AddCost, PacketAccess = CastingTraits::VectorizedCast && (CastingTraits::SrcCoeffRatio <= 8) }; }; @@ -706,7 +706,7 @@ struct functor_traits<scalar_tanh_op<Scalar>> { enum { PacketAccess = packet_traits<Scalar>::HasTanh, - Cost = ((EIGEN_FAST_MATH && is_same<Scalar, float>::value) + Cost = ((EIGEN_FAST_MATH && std::is_same<Scalar, float>::value) // The following numbers are based on the AVX implementation, #ifdef EIGEN_VECTORIZE_FMA // Haswell can issue 2 add/mul/madd per cycle. @@ -1157,7 +1157,7 @@ struct scalar_bitwise_not_op { EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::RequireInitialization, BITWISE OPERATIONS MAY ONLY BE PERFORMED ON PLAIN DATA TYPES) - EIGEN_STATIC_ASSERT((!internal::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES) + EIGEN_STATIC_ASSERT((!std::is_same<Scalar, bool>::value), DONT USE BITWISE OPS ON BOOLEAN TYPES) using result_type = Scalar; EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar operator()(const Scalar& a) const { return bitwise_unary_impl<Scalar>::run_not(a); @@ -1321,10 +1321,10 @@ // The cost estimate for float here here is for the common(?) case where // all arguments are greater than -9. Cost = scalar_div_cost<T, packet_traits<T>::HasDiv>::value + - (internal::is_same<T, float>::value ? NumTraits<T>::AddCost * 15 + NumTraits<T>::MulCost * 11 - : NumTraits<T>::AddCost * 2 + functor_traits<scalar_exp_op<T>>::Cost), + (std::is_same<T, float>::value ? NumTraits<T>::AddCost * 15 + NumTraits<T>::MulCost * 11 + : NumTraits<T>::AddCost * 2 + functor_traits<scalar_exp_op<T>>::Cost), PacketAccess = !NumTraits<T>::IsComplex && packet_traits<T>::HasAdd && packet_traits<T>::HasDiv && - (internal::is_same<T, float>::value + (std::is_same<T, float>::value ? packet_traits<T>::HasMul && packet_traits<T>::HasMax && packet_traits<T>::HasMin : packet_traits<T>::HasNegate && packet_traits<T>::HasExp) };
diff --git a/Eigen/src/Core/products/GeneralBlockPanelKernel.h b/Eigen/src/Core/products/GeneralBlockPanelKernel.h index 011e9ad..98f2844 100644 --- a/Eigen/src/Core/products/GeneralBlockPanelKernel.h +++ b/Eigen/src/Core/products/GeneralBlockPanelKernel.h
@@ -603,16 +603,16 @@ EIGEN_STRONG_INLINE void updateRhs(const RhsScalar*, RhsPacketx4&) const {} EIGEN_STRONG_INLINE void loadRhsQuad(const RhsScalar* b, RhsPacket& dest) const { - loadRhsQuad_impl(b, dest, std::conditional_t<RhsPacketSize == 16, true_type, false_type>()); + loadRhsQuad_impl(b, dest, std::conditional_t<RhsPacketSize == 16, std::true_type, std::false_type>()); } - EIGEN_STRONG_INLINE void loadRhsQuad_impl(const RhsScalar* b, RhsPacket& dest, const true_type&) const { + EIGEN_STRONG_INLINE void loadRhsQuad_impl(const RhsScalar* b, RhsPacket& dest, const std::true_type&) const { // FIXME: replace with a dedicated ploadheight operation for more efficient quad loading. RhsScalar tmp[4] = {b[0], b[0], b[1], b[1]}; dest = ploadquad<RhsPacket>(tmp); } - EIGEN_STRONG_INLINE void loadRhsQuad_impl(const RhsScalar* b, RhsPacket& dest, const false_type&) const { + EIGEN_STRONG_INLINE void loadRhsQuad_impl(const RhsScalar* b, RhsPacket& dest, const std::false_type&) const { eigen_internal_assert(RhsPacketSize <= 8); dest = pset1<RhsPacket>(*b); } @@ -627,12 +627,12 @@ template <typename LhsPacketType, typename RhsPacketType, typename AccPacketType, typename LaneIdType> EIGEN_STRONG_INLINE void madd(const LhsPacketType& a, const RhsPacketType& b, AccPacketType& c, RhsPacketType& tmp, const LaneIdType&) const { - madd_impl(a, b, c, tmp, std::conditional_t<Vectorizable, true_type, false_type>()); + madd_impl(a, b, c, tmp, std::conditional_t<Vectorizable, std::true_type, std::false_type>()); } template <typename LhsPacketType, typename RhsPacketType, typename AccPacketType> EIGEN_STRONG_INLINE void madd_impl(const LhsPacketType& a, const RhsPacketType& b, AccPacketType& c, - RhsPacketType& tmp, const true_type&) const { + RhsPacketType& tmp, const std::true_type&) const { #ifdef EIGEN_HAS_SINGLE_INSTRUCTION_MADD EIGEN_UNUSED_VARIABLE(tmp); c.v = pmadd(a.v, b, c.v); @@ -644,7 +644,7 @@ } EIGEN_STRONG_INLINE void madd_impl(const LhsScalar& a, const RhsScalar& b, ResScalar& c, RhsScalar& /*tmp*/, - const false_type&) const { + const std::false_type&) const { c += a * b; } @@ -824,11 +824,9 @@ template <typename LhsPacketType, typename RhsPacketType, typename ResPacketType, typename TmpType, typename LaneIdType> - EIGEN_STRONG_INLINE std::enable_if_t<!is_same<RhsPacketType, RhsPacketx4>::value> madd(const LhsPacketType& a, - const RhsPacketType& b, - DoublePacket<ResPacketType>& c, - TmpType& /*tmp*/, - const LaneIdType&) const { + EIGEN_STRONG_INLINE std::enable_if_t<!std::is_same<RhsPacketType, RhsPacketx4>::value> madd( + const LhsPacketType& a, const RhsPacketType& b, DoublePacket<ResPacketType>& c, TmpType& /*tmp*/, + const LaneIdType&) const { c.first = pmadd(a, b.first, c.first); c.second = pmadd(a, b.second, c.second); } @@ -946,12 +944,12 @@ template <typename LhsPacketType, typename RhsPacketType, typename AccPacketType, typename LaneIdType> EIGEN_STRONG_INLINE void madd(const LhsPacketType& a, const RhsPacketType& b, AccPacketType& c, RhsPacketType& tmp, const LaneIdType&) const { - madd_impl(a, b, c, tmp, std::conditional_t<Vectorizable, true_type, false_type>()); + madd_impl(a, b, c, tmp, std::conditional_t<Vectorizable, std::true_type, std::false_type>()); } template <typename LhsPacketType, typename RhsPacketType, typename AccPacketType> EIGEN_STRONG_INLINE void madd_impl(const LhsPacketType& a, const RhsPacketType& b, AccPacketType& c, - RhsPacketType& tmp, const true_type&) const { + RhsPacketType& tmp, const std::true_type&) const { #ifdef EIGEN_HAS_SINGLE_INSTRUCTION_MADD EIGEN_UNUSED_VARIABLE(tmp); c.v = pmadd(a, b.v, c.v); @@ -963,7 +961,7 @@ } EIGEN_STRONG_INLINE void madd_impl(const LhsScalar& a, const RhsScalar& b, ResScalar& c, RhsScalar& /*tmp*/, - const false_type&) const { + const std::false_type&) const { c += a * b; }
diff --git a/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h b/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h index f814811..6800071 100644 --- a/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +++ b/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h
@@ -153,7 +153,7 @@ typedef gebp_traits<LhsScalar, RhsScalar, ConjLhs, ConjRhs> Traits; typedef typename Traits::ResScalar ResScalar; - enum { BlockSize = meta_least_common_multiple<plain_enum_max(mr, nr), plain_enum_min(mr, nr)>::ret }; + enum { BlockSize = meta_least_common_multiple<plain_enum_max(mr, nr), plain_enum_min(mr, nr)>::value }; void operator()(ResScalar* res_, Index resIncr, Index resStride, const LhsScalar* blockA, const RhsScalar* blockB, Index size, Index depth, const ResScalar& alpha) const { typedef blas_data_mapper<ResScalar, Index, ColMajor, Unaligned, ResInnerStride> ResMapper;
diff --git a/Eigen/src/Core/util/BlasUtil.h b/Eigen/src/Core/util/BlasUtil.h index 6918081..9aa3cc1 100644 --- a/Eigen/src/Core/util/BlasUtil.h +++ b/Eigen/src/Core/util/BlasUtil.h
@@ -470,7 +470,7 @@ NeedToConjugate = false, HasUsableDirectAccess = ((int(XprType::Flags) & DirectAccessBit) && - (bool(XprType::IsVectorAtCompileTime) || int(inner_stride_at_compile_time<XprType>::ret) == 1)) + (bool(XprType::IsVectorAtCompileTime) || int(inner_stride_at_compile_time<XprType>::value) == 1)) ? 1 : 0, HasScalarFactor = false
diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index a9ebd07..9746747 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h
@@ -29,9 +29,7 @@ struct traits<const T> : traits<T> {}; template <typename Derived> -struct has_direct_access { - enum { ret = (traits<Derived>::Flags & DirectAccessBit) ? 1 : 0 }; -}; +struct has_direct_access : std::integral_constant<bool, (traits<Derived>::Flags & DirectAccessBit) != 0> {}; template <typename Derived> struct accessors_level { @@ -228,7 +226,7 @@ * Products need their own evaluator with more template arguments allowing for * easier partial template specializations. */ -template <typename T, int ProductTag = internal::product_type<typename T::Lhs, typename T::Rhs>::ret, +template <typename T, int ProductTag = internal::product_type<typename T::Lhs, typename T::Rhs>::value, typename LhsShape = typename evaluator_traits<typename T::Lhs>::Shape, typename RhsShape = typename evaluator_traits<typename T::Rhs>::Shape, typename LhsScalar = typename traits<typename T::Lhs>::Scalar,
diff --git a/Eigen/src/Core/util/IndexedViewHelper.h b/Eigen/src/Core/util/IndexedViewHelper.h index 1cc4aca..1f48bde 100644 --- a/Eigen/src/Core/util/IndexedViewHelper.h +++ b/Eigen/src/Core/util/IndexedViewHelper.h
@@ -251,10 +251,10 @@ }; template <typename T> -struct is_single_range : public std::false_type {}; +struct is_single_range : std::false_type {}; template <Index ValueAtCompileTime> -struct is_single_range<SingleRange<ValueAtCompileTime>> : public std::true_type {}; +struct is_single_range<SingleRange<ValueAtCompileTime>> : std::true_type {}; template <typename SingleIndex, int NestedSizeAtCompileTime> struct IndexedViewHelperIndicesWrapper<
diff --git a/Eigen/src/Core/util/IntegralConstant.h b/Eigen/src/Core/util/IntegralConstant.h index a7c3766..a2d79be 100644 --- a/Eigen/src/Core/util/IntegralConstant.h +++ b/Eigen/src/Core/util/IntegralConstant.h
@@ -187,7 +187,7 @@ // Convert any integral type (e.g., short, int, unsigned int, etc.) to Eigen::Index template <typename T, int DynamicKey> -struct cleanup_index_type<T, DynamicKey, std::enable_if_t<internal::is_integral<T>::value>> { +struct cleanup_index_type<T, DynamicKey, std::enable_if_t<std::is_integral<T>::value>> { typedef Index type; };
diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index 75be1b6..ab6c2ce 100644 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h
@@ -91,17 +91,22 @@ * we however don't want to add a dependency to Boost. */ -using std::false_type; -using std::true_type; - template <bool Condition> using bool_constant = std::integral_constant<bool, Condition>; -// Third-party libraries rely on these. +// Deprecated compatibility aliases. Third-party libraries rely on these, but new code should use std:: directly. using std::conditional; +using std::false_type; +using std::is_const; +using std::is_convertible; +using std::is_integral; +using std::is_same; +using std::is_void; +using std::make_unsigned; using std::remove_const; using std::remove_pointer; using std::remove_reference; +using std::true_type; template <typename T> struct remove_all { @@ -135,21 +140,13 @@ // for SIMD packet types and other Eigen-specific types. The primary template // delegates to std::is_arithmetic for fundamental types. template <typename T> -struct is_arithmetic { - enum { value = std::is_arithmetic<T>::value }; -}; +struct is_arithmetic : std::is_arithmetic<T> {}; // GPU devices treat `long double` as `double`. #ifdef EIGEN_GPU_COMPILE_PHASE template <> -struct is_arithmetic<long double> { - enum { value = false }; -}; +struct is_arithmetic<long double> : std::false_type {}; #endif -using std::is_same; - -using std::is_void; - /** \internal * Implementation of std::void_t for SFINAE. * @@ -165,12 +162,6 @@ using void_t = void; #endif -using std::is_integral; - -using std::make_unsigned; - -using std::is_const; - template <typename T> struct add_const_on_value_type { typedef const T type; @@ -195,8 +186,6 @@ template <typename T> using add_const_on_value_type_t = typename add_const_on_value_type<T>::type; -using std::is_convertible; - /** \internal * Provides access to the number of elements in the object of as a compile-time constant expression. * It "returns" Eigen::Dynamic if the size cannot be resolved at compile-time (default). @@ -287,13 +276,13 @@ template <typename F, typename... ArgTypes> struct result_of<F(ArgTypes...)> { - typedef typename std::invoke_result<F, ArgTypes...>::type type1; + typedef std::invoke_result_t<F, ArgTypes...> type1; typedef remove_all_t<type1> type; }; #else template <typename T> struct result_of { - typedef typename std::result_of<T>::type type1; + typedef std::result_of_t<T> type1; typedef remove_all_t<type1> type; }; #endif @@ -305,49 +294,44 @@ // Check whether T::ReturnType does exist template <typename T, typename EnableIf = void> -struct has_ReturnType : false_type {}; +struct has_ReturnType : std::false_type {}; template <typename T> -struct has_ReturnType<T, void_t<typename T::ReturnType>> : true_type {}; +struct has_ReturnType<T, void_t<typename T::ReturnType>> : std::true_type {}; template <typename T, typename IndexType = Index, typename EnableIf = void> -struct has_nullary_operator : false_type {}; +struct has_nullary_operator : std::false_type {}; template <typename T, typename IndexType> struct has_nullary_operator<T, IndexType, std::enable_if_t<(sizeof(decltype(std::declval<const T&>()())) > 0)>> - : true_type {}; + : std::true_type {}; template <typename T, typename IndexType = Index, typename EnableIf = void> -struct has_unary_operator : false_type {}; +struct has_unary_operator : std::false_type {}; template <typename T, typename IndexType> struct has_unary_operator<T, IndexType, std::enable_if_t<(sizeof(decltype(std::declval<const T&>()(IndexType(0)))) > 0)>> - : true_type {}; + : std::true_type {}; template <typename T, typename IndexType = Index, typename EnableIf = void> -struct has_binary_operator : false_type {}; +struct has_binary_operator : std::false_type {}; template <typename T, typename IndexType> struct has_binary_operator< T, IndexType, std::enable_if_t<(sizeof(decltype(std::declval<const T&>()(IndexType(0), IndexType(0)))) > 0)>> - : true_type {}; + : std::true_type {}; /** \internal Computes the least common multiple of two positive integer A and B * at compile-time. */ template <int A, int B, int K = 1, bool Done = ((A * K) % B) == 0, bool Big = (A >= B)> -struct meta_least_common_multiple { - enum { ret = meta_least_common_multiple<A, B, K + 1>::ret }; -}; +struct meta_least_common_multiple : std::integral_constant<int, meta_least_common_multiple<A, B, K + 1>::value> {}; template <int A, int B, int K, bool Done> -struct meta_least_common_multiple<A, B, K, Done, false> { - enum { ret = meta_least_common_multiple<B, A, K>::ret }; -}; +struct meta_least_common_multiple<A, B, K, Done, false> + : std::integral_constant<int, meta_least_common_multiple<B, A, K>::value> {}; template <int A, int B, int K> -struct meta_least_common_multiple<A, B, K, true, true> { - enum { ret = A * K }; -}; +struct meta_least_common_multiple<A, B, K, true, true> : std::integral_constant<int, A * K> {}; /** \internal determines whether the product of two numeric types is allowed and what the return type is */ template <typename T, typename U> @@ -481,15 +465,14 @@ return is_identically_zero_impl<Scalar>::run(s); } -/// \internal Returns true if its argument is of integer or enum type. -/// FIXME this has the same purpose as `is_valid_index_type` in XprHelper.h -template <typename A> -constexpr bool is_int_or_enum_v = std::is_enum<A>::value || std::is_integral<A>::value; +// true if T can be considered as an integral index (i.e., an integral type or enum) +template <typename T> +struct is_valid_index_type : std::integral_constant<bool, std::is_integral<T>::value || std::is_enum<T>::value> {}; template <typename A, typename B> constexpr void plain_enum_asserts(A, B) { - static_assert(is_int_or_enum_v<A>, "Argument a must be an integer or enum"); - static_assert(is_int_or_enum_v<B>, "Argument b must be an integer or enum"); + static_assert(is_valid_index_type<A>::value, "Argument a must be an integer or enum"); + static_assert(is_valid_index_type<B>::value, "Argument b must be an integer or enum"); } /// \internal Gets the minimum of two values which may be integers or enums
diff --git a/Eigen/src/Core/util/MoreMeta.h b/Eigen/src/Core/util/MoreMeta.h index f9f71ff..c950d44 100644 --- a/Eigen/src/Core/util/MoreMeta.h +++ b/Eigen/src/Core/util/MoreMeta.h
@@ -30,64 +30,6 @@ typedef t first_type; }; -template <typename T, T... nn> -struct numeric_list { - constexpr static std::size_t count = sizeof...(nn); -}; - -template <typename T, T n, T... nn> -struct numeric_list<T, n, nn...> { - static constexpr std::size_t count = sizeof...(nn) + 1; - static constexpr T first_value = n; -}; - -// Ddoxygen doesn't like the recursive definition of gen_numeric_list. -#ifndef EIGEN_PARSED_BY_DOXYGEN -/* numeric list constructors - * - * equivalencies: - * constructor result - * typename gen_numeric_list<int, 5>::type numeric_list<int, 0,1,2,3,4> - * typename gen_numeric_list_reversed<int, 5>::type numeric_list<int, 4,3,2,1,0> - * typename gen_numeric_list_swapped_pair<int, 5,1,2>::type numeric_list<int, 0,2,1,3,4> - * typename gen_numeric_list_repeated<int, 0, 5>::type numeric_list<int, 0,0,0,0,0> - */ - -template <typename T, std::size_t n, T start = 0, T... ii> -struct gen_numeric_list : gen_numeric_list<T, n - 1, start, start + n - 1, ii...> {}; - -template <typename T, T start, T... ii> -struct gen_numeric_list<T, 0, start, ii...> { - typedef numeric_list<T, ii...> type; -}; - -template <typename T, std::size_t n, T start = 0, T... ii> -struct gen_numeric_list_reversed : gen_numeric_list_reversed<T, n - 1, start, ii..., start + n - 1> {}; -template <typename T, T start, T... ii> -struct gen_numeric_list_reversed<T, 0, start, ii...> { - typedef numeric_list<T, ii...> type; -}; - -template <typename T, std::size_t n, T a, T b, T start = 0, T... ii> -struct gen_numeric_list_swapped_pair - : gen_numeric_list_swapped_pair<T, n - 1, a, b, start, - (start + n - 1) == a ? b : ((start + n - 1) == b ? a : (start + n - 1)), ii...> {}; -template <typename T, T a, T b, T start, T... ii> -struct gen_numeric_list_swapped_pair<T, 0, a, b, start, ii...> { - typedef numeric_list<T, ii...> type; -}; - -template <typename T, std::size_t n, T V, T... nn> -struct gen_numeric_list_repeated : gen_numeric_list_repeated<T, n - 1, V, V, nn...> {}; -template <typename T, T V, T... nn> -struct gen_numeric_list_repeated<T, 0, V, nn...> { - typedef numeric_list<T, nn...> type; -}; -#else -template <typename T, std::size_t n, T start = 0, T... ii> -struct gen_numeric_list; -#endif // not EIGEN_PARSED_BY_DOXYGEN - /* list manipulation: concatenate */ template <class a, class b> @@ -97,10 +39,6 @@ struct concat<type_list<as...>, type_list<bs...>> { typedef type_list<as..., bs...> type; }; -template <typename T, T... as, T... bs> -struct concat<numeric_list<T, as...>, numeric_list<T, bs...>> { - typedef numeric_list<T, as..., bs...> type; -}; template <typename... p> struct mconcat; @@ -136,37 +74,6 @@ typedef type_list<> type; }; -template <typename T, int n, T a, T... as> -struct take<n, numeric_list<T, a, as...>> - : concat<numeric_list<T, a>, typename take<n - 1, numeric_list<T, as...>>::type> {}; - -template <typename T, T a, T... as> -struct take<0, numeric_list<T, a, as...>> { - typedef numeric_list<T> type; -}; - -template <typename T> -struct take<0, numeric_list<T>> { - typedef numeric_list<T> type; -}; - -template <typename T, int n, T... ii> -struct h_skip_helper_numeric; -template <typename T, int n, T i, T... ii> -struct h_skip_helper_numeric<T, n, i, ii...> : h_skip_helper_numeric<T, n - 1, ii...> {}; -template <typename T, T i, T... ii> -struct h_skip_helper_numeric<T, 0, i, ii...> { - typedef numeric_list<T, i, ii...> type; -}; -template <typename T, int n> -struct h_skip_helper_numeric<T, n> { - typedef numeric_list<T> type; -}; -template <typename T> -struct h_skip_helper_numeric<T, 0> { - typedef numeric_list<T> type; -}; - template <int n, typename... tt> struct h_skip_helper_type; template <int n, typename t, typename... tt> @@ -186,10 +93,6 @@ template <int n> struct h_skip { - template <typename T, T... ii> - constexpr static typename h_skip_helper_numeric<T, n, ii...>::type helper(numeric_list<T, ii...>) { - return typename h_skip_helper_numeric<T, n, ii...>::type(); - } template <typename... tt> constexpr static typename h_skip_helper_type<n, tt...>::type helper(type_list<tt...>) { return typename h_skip_helper_type<n, tt...>::type(); @@ -217,17 +120,12 @@ }; template <typename T, int n, T a, T... as> -struct get<n, numeric_list<T, a, as...>> : get<n - 1, numeric_list<T, as...>> {}; +struct get<n, std::integer_sequence<T, a, as...>> : get<n - 1, std::integer_sequence<T, as...>> {}; template <typename T, T a, T... as> -struct get<0, numeric_list<T, a, as...>> { +struct get<0, std::integer_sequence<T, a, as...>> { constexpr static T value = a; }; -template <std::size_t n, typename T, T a, T... as> -constexpr T array_get(const numeric_list<T, a, as...>&) { - return get<(int)n, numeric_list<T, a, as...>>::value; -} - /* always get type, regardless of dummy; good for parameter pack expansion */ template <typename T, T dummy, typename t> @@ -242,7 +140,7 @@ /* equality checking, flagged version */ template <typename a, typename b> -struct is_same_gf : is_same<a, b> { +struct is_same_gf : std::is_same<a, b> { constexpr static int global_flags = 0; }; @@ -363,28 +261,6 @@ static constexpr int Identity = 1; }; -struct logical_and_op { - template <typename A, typename B> - constexpr static auto run(A a, B b) -> decltype(a && b) { - return a && b; - } -}; -struct lesser_op { - template <typename A, typename B> - constexpr static auto run(A a, B b) -> decltype(a < b) { - return a < b; - } -}; - -/* generic unary operations */ - -struct greater_equal_zero_op { - template <typename A> - constexpr static auto run(A a) -> decltype(a >= 0) { - return a >= 0; - } -}; - /* reductions for lists */ // Using auto -> return value spec makes ICC 13.0 and 13.1 crash here, @@ -399,18 +275,6 @@ return reduce<sum_op, Ts...>::run(ts...); } -/* reverse arrays */ - -template <typename Array, int... n> -constexpr Array h_array_reverse(Array arr, numeric_list<int, n...>) { - return {{array_get<sizeof...(n) - n - 1>(arr)...}}; -} - -template <typename T, std::size_t N> -constexpr array<T, N> array_reverse(array<T, N> arr) { - return h_array_reverse(arr, typename gen_numeric_list<int, N>::type()); -} - /* generic array reductions */ // can't reuse standard reduce() interface above because Intel's Compiler @@ -466,119 +330,6 @@ return prod; } -/* zip an array */ - -template <typename Op, typename A, typename B, std::size_t N, int... n> -constexpr array<decltype(Op::run(A(), B())), N> h_array_zip(array<A, N> a, array<B, N> b, numeric_list<int, n...>) { - return array<decltype(Op::run(A(), B())), N>{{Op::run(array_get<n>(a), array_get<n>(b))...}}; -} - -template <typename Op, typename A, typename B, std::size_t N> -constexpr array<decltype(Op::run(A(), B())), N> array_zip(array<A, N> a, array<B, N> b) { - return h_array_zip<Op>(a, b, typename gen_numeric_list<int, N>::type()); -} - -/* zip an array and reduce the result */ - -template <typename Reducer, typename Op, typename A, typename B, std::size_t N, int... n> -constexpr auto h_array_zip_and_reduce(array<A, N> a, array<B, N> b, numeric_list<int, n...>) - -> decltype(reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A(), B()))>::type...>::run( - Op::run(array_get<n>(a), array_get<n>(b))...)) { - return reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A(), B()))>::type...>::run( - Op::run(array_get<n>(a), array_get<n>(b))...); -} - -template <typename Reducer, typename Op, typename A, typename B, std::size_t N> -constexpr auto array_zip_and_reduce(array<A, N> a, array<B, N> b) - -> decltype(h_array_zip_and_reduce<Reducer, Op, A, B, N>(a, b, typename gen_numeric_list<int, N>::type())) { - return h_array_zip_and_reduce<Reducer, Op, A, B, N>(a, b, typename gen_numeric_list<int, N>::type()); -} - -/* apply stuff to an array */ - -template <typename Op, typename A, std::size_t N, int... n> -constexpr array<decltype(Op::run(A())), N> h_array_apply(array<A, N> a, numeric_list<int, n...>) { - return array<decltype(Op::run(A())), N>{{Op::run(array_get<n>(a))...}}; -} - -template <typename Op, typename A, std::size_t N> -constexpr array<decltype(Op::run(A())), N> array_apply(array<A, N> a) { - return h_array_apply<Op>(a, typename gen_numeric_list<int, N>::type()); -} - -/* apply stuff to an array and reduce */ - -template <typename Reducer, typename Op, typename A, std::size_t N, int... n> -constexpr auto h_array_apply_and_reduce(array<A, N> arr, numeric_list<int, n...>) - -> decltype(reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A()))>::type...>::run( - Op::run(array_get<n>(arr))...)) { - return reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A()))>::type...>::run( - Op::run(array_get<n>(arr))...); -} - -template <typename Reducer, typename Op, typename A, std::size_t N> -constexpr auto array_apply_and_reduce(array<A, N> a) - -> decltype(h_array_apply_and_reduce<Reducer, Op, A, N>(a, typename gen_numeric_list<int, N>::type())) { - return h_array_apply_and_reduce<Reducer, Op, A, N>(a, typename gen_numeric_list<int, N>::type()); -} - -/* repeat a value n times (and make an array out of it - * usage: - * array<int, 16> = repeat<16>(42); - */ - -template <int n> -struct h_repeat { - template <typename t, int... ii> - constexpr static array<t, n> run(t v, numeric_list<int, ii...>) { - return {{typename id_numeric<int, ii, t>::type(v)...}}; - } -}; - -template <int n, typename t> -constexpr array<t, n> repeat(t v) { - return h_repeat<n>::run(v, typename gen_numeric_list<int, n>::type()); -} - -/* instantiate a class by a C-style array */ -template <class InstType, typename ArrType, std::size_t N, bool Reverse, typename... Ps> -struct h_instantiate_by_c_array; - -template <class InstType, typename ArrType, std::size_t N, typename... Ps> -struct h_instantiate_by_c_array<InstType, ArrType, N, false, Ps...> { - static InstType run(ArrType* arr, Ps... args) { - return h_instantiate_by_c_array<InstType, ArrType, N - 1, false, Ps..., ArrType>::run(arr + 1, args..., arr[0]); - } -}; - -template <class InstType, typename ArrType, std::size_t N, typename... Ps> -struct h_instantiate_by_c_array<InstType, ArrType, N, true, Ps...> { - static InstType run(ArrType* arr, Ps... args) { - return h_instantiate_by_c_array<InstType, ArrType, N - 1, false, ArrType, Ps...>::run(arr + 1, arr[0], args...); - } -}; - -template <class InstType, typename ArrType, typename... Ps> -struct h_instantiate_by_c_array<InstType, ArrType, 0, false, Ps...> { - static InstType run(ArrType* arr, Ps... args) { - (void)arr; - return InstType(args...); - } -}; - -template <class InstType, typename ArrType, typename... Ps> -struct h_instantiate_by_c_array<InstType, ArrType, 0, true, Ps...> { - static InstType run(ArrType* arr, Ps... args) { - (void)arr; - return InstType(args...); - } -}; - -template <class InstType, typename ArrType, std::size_t N, bool Reverse = false> -InstType instantiate_by_c_array(ArrType* arr) { - return h_instantiate_by_c_array<InstType, ArrType, N, Reverse>::run(arr); -} - } // end namespace internal } // end namespace Eigen
diff --git a/Eigen/src/Core/util/ReshapedHelper.h b/Eigen/src/Core/util/ReshapedHelper.h index 5046f7b..5b39660 100644 --- a/Eigen/src/Core/util/ReshapedHelper.h +++ b/Eigen/src/Core/util/ReshapedHelper.h
@@ -22,9 +22,7 @@ namespace internal { template <typename SizeType, typename OtherSize, int TotalSize> -struct get_compiletime_reshape_size { - enum { value = get_fixed_value<SizeType>::value }; -}; +struct get_compiletime_reshape_size : get_fixed_value<SizeType> {}; template <typename SizeType> Index get_runtime_reshape_size(SizeType size, Index /*other*/, Index /*total*/) {
diff --git a/Eigen/src/Core/util/Serializer.h b/Eigen/src/Core/util/Serializer.h index 558e166..73e9cfe 100644 --- a/Eigen/src/Core/util/Serializer.h +++ b/Eigen/src/Core/util/Serializer.h
@@ -29,8 +29,7 @@ // Specialization for POD types. template <typename T> -class Serializer<T, - typename std::enable_if_t<std::is_trivially_copyable<T>::value && std::is_standard_layout<T>::value>> { +class Serializer<T, std::enable_if_t<std::is_trivially_copyable<T>::value && std::is_standard_layout<T>::value>> { public: /** * Determines the required size of the serialization buffer for a value.
diff --git a/Eigen/src/Core/util/StaticAssert.h b/Eigen/src/Core/util/StaticAssert.h index eeec6c3..4a243af 100644 --- a/Eigen/src/Core/util/StaticAssert.h +++ b/Eigen/src/Core/util/StaticAssert.h
@@ -65,8 +65,8 @@ YOU_MIXED_VECTORS_OF_DIFFERENT_SIZES) #define EIGEN_PREDICATE_SAME_MATRIX_SIZE(TYPE0, TYPE1) \ - ((int(Eigen::internal::size_of_xpr_at_compile_time<TYPE0>::ret) == 0 && \ - int(Eigen::internal::size_of_xpr_at_compile_time<TYPE1>::ret) == 0) || \ + ((int(Eigen::internal::size_of_xpr_at_compile_time<TYPE0>::value) == 0 && \ + int(Eigen::internal::size_of_xpr_at_compile_time<TYPE1>::value) == 0) || \ ((int(TYPE0::RowsAtCompileTime) == Eigen::Dynamic || int(TYPE1::RowsAtCompileTime) == Eigen::Dynamic || \ int(TYPE0::RowsAtCompileTime) == int(TYPE1::RowsAtCompileTime)) && \ (int(TYPE0::ColsAtCompileTime) == Eigen::Dynamic || int(TYPE1::ColsAtCompileTime) == Eigen::Dynamic || \ @@ -88,13 +88,13 @@ #define EIGEN_STATIC_ASSERT_LVALUE(Derived) \ EIGEN_STATIC_ASSERT(Eigen::internal::is_lvalue<Derived>::value, THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY) -#define EIGEN_STATIC_ASSERT_ARRAYXPR(Derived) \ - EIGEN_STATIC_ASSERT((Eigen::internal::is_same<typename Eigen::internal::traits<Derived>::XprKind, ArrayXpr>::value), \ +#define EIGEN_STATIC_ASSERT_ARRAYXPR(Derived) \ + EIGEN_STATIC_ASSERT((std::is_same<typename Eigen::internal::traits<Derived>::XprKind, ArrayXpr>::value), \ THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES) -#define EIGEN_STATIC_ASSERT_SAME_XPR_KIND(Derived1, Derived2) \ - EIGEN_STATIC_ASSERT((Eigen::internal::is_same<typename Eigen::internal::traits<Derived1>::XprKind, \ - typename Eigen::internal::traits<Derived2>::XprKind>::value), \ +#define EIGEN_STATIC_ASSERT_SAME_XPR_KIND(Derived1, Derived2) \ + EIGEN_STATIC_ASSERT((std::is_same<typename Eigen::internal::traits<Derived1>::XprKind, \ + typename Eigen::internal::traits<Derived2>::XprKind>::value), \ YOU_CANNOT_MIX_ARRAYS_AND_MATRICES) // Check that a cost value is positive, and that is stay within a reasonable range
diff --git a/Eigen/src/Core/util/SymbolicIndex.h b/Eigen/src/Core/util/SymbolicIndex.h index 3c1d9ba..4d936fe 100644 --- a/Eigen/src/Core/util/SymbolicIndex.h +++ b/Eigen/src/Core/util/SymbolicIndex.h
@@ -176,12 +176,10 @@ } }; +// BaseExpr has no conversion ctor, so we only have to check whether T can be statically cast to its base class +// BaseExpr<T>. template <typename T> -struct is_symbolic { - // BaseExpr has no conversion ctor, so we only have to check whether T can be statically cast to its base class - // BaseExpr<T>. - enum { value = internal::is_convertible<T, BaseExpr<T>>::value }; -}; +struct is_symbolic : std::is_convertible<T, BaseExpr<T>> {}; // A simple wrapper around an integral value to provide the eval method. // We could also use a free-function symbolic_eval...
diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index 4ae9daf..5d2ce1d 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h
@@ -64,18 +64,10 @@ return convert_index_impl<IndexDest, IndexSrc>::run(idx); } -// true if T can be considered as an integral index (i.e., and integral type or enum) -template <typename T> -struct is_valid_index_type { - enum { value = internal::is_integral<T>::value || std::is_enum<T>::value }; -}; - // true if both types are not valid index types template <typename RowIndices, typename ColIndices> -struct valid_indexed_view_overload { - enum { - value = !(internal::is_valid_index_type<RowIndices>::value && internal::is_valid_index_type<ColIndices>::value) - }; +struct valid_indexed_view_overload : std::integral_constant<bool, !(internal::is_valid_index_type<RowIndices>::value && + internal::is_valid_index_type<ColIndices>::value)> { }; // promote_scalar_arg is an helper used in operation between an expression and a scalar, like: @@ -102,7 +94,7 @@ // Recursively check safe conversion to PromotedType, and then ExprScalar if they are different. template <typename ExprScalar, typename T, typename PromotedType, - bool ConvertibleToLiteral = internal::is_convertible<T, PromotedType>::value, + bool ConvertibleToLiteral = std::is_convertible<T, PromotedType>::value, bool IsSafe = NumTraits<T>::IsInteger || !NumTraits<PromotedType>::IsInteger> struct promote_scalar_arg_unsupported; @@ -270,7 +262,7 @@ template <int Size, typename PacketType, bool Stop = Size == Dynamic || (Size % unpacket_traits<PacketType>::size) == 0 || - is_same<PacketType, typename unpacket_traits<PacketType>::half>::value> + std::is_same<PacketType, typename unpacket_traits<PacketType>::half>::value> struct find_best_packet_helper; template <int Size, typename PacketType> @@ -290,7 +282,7 @@ template <int Size, typename PacketType, bool Stop = (Size == unpacket_traits<PacketType>::size) || - is_same<PacketType, typename unpacket_traits<PacketType>::half>::value> + std::is_same<PacketType, typename unpacket_traits<PacketType>::half>::value> struct find_packet_by_size_helper; template <int Size, typename PacketType> struct find_packet_by_size_helper<Size, PacketType, true> { @@ -333,14 +325,11 @@ #endif template <typename T, int Size> -struct compute_default_alignment { - enum { value = compute_default_alignment_helper(Size * sizeof(T), EIGEN_MAX_STATIC_ALIGN_BYTES) }; -}; +struct compute_default_alignment + : std::integral_constant<int, compute_default_alignment_helper(Size * sizeof(T), EIGEN_MAX_STATIC_ALIGN_BYTES)> {}; template <typename T> -struct compute_default_alignment<T, Dynamic> { - enum { value = EIGEN_MAX_ALIGN_BYTES }; -}; +struct compute_default_alignment<T, Dynamic> : std::integral_constant<int, EIGEN_MAX_ALIGN_BYTES> {}; template <typename Scalar_, int Rows_, int Cols_, int Options_ = AutoAlign | ((Rows_ == 1 && Cols_ != 1) ? RowMajor @@ -374,9 +363,9 @@ } template <typename XprType> -struct size_of_xpr_at_compile_time { - enum { ret = size_at_compile_time(traits<XprType>::RowsAtCompileTime, traits<XprType>::ColsAtCompileTime) }; -}; +struct size_of_xpr_at_compile_time + : std::integral_constant<int, size_at_compile_time(traits<XprType>::RowsAtCompileTime, + traits<XprType>::ColsAtCompileTime)> {}; /* plain_matrix_type : the difference from eval is that plain_matrix_type is always a plain matrix type, * whereas eval is a const reference in the case of a matrix @@ -554,7 +543,7 @@ using CurrentScalarType = typename XprType::Scalar; using CastType_ = remove_all_t<CastType>; using NewScalarType = typename CastType_::Scalar; - using type = std::conditional_t<is_same<CurrentScalarType, NewScalarType>::value, const XprType&, CastType>; + using type = std::conditional_t<std::is_same<CurrentScalarType, NewScalarType>::value, const XprType&, CastType>; }; template <typename A, typename B> @@ -615,22 +604,14 @@ }; template <typename LhsKind, typename RhsKind, int LhsOrder, int RhsOrder> -struct cwise_promote_storage_order { - enum { value = LhsOrder }; -}; +struct cwise_promote_storage_order : std::integral_constant<int, LhsOrder> {}; template <typename LhsKind, int LhsOrder, int RhsOrder> -struct cwise_promote_storage_order<LhsKind, Sparse, LhsOrder, RhsOrder> { - enum { value = RhsOrder }; -}; +struct cwise_promote_storage_order<LhsKind, Sparse, LhsOrder, RhsOrder> : std::integral_constant<int, RhsOrder> {}; template <typename RhsKind, int LhsOrder, int RhsOrder> -struct cwise_promote_storage_order<Sparse, RhsKind, LhsOrder, RhsOrder> { - enum { value = LhsOrder }; -}; +struct cwise_promote_storage_order<Sparse, RhsKind, LhsOrder, RhsOrder> : std::integral_constant<int, LhsOrder> {}; template <int Order> -struct cwise_promote_storage_order<Sparse, Sparse, Order, Order> { - enum { value = Order }; -}; +struct cwise_promote_storage_order<Sparse, Sparse, Order, Order> : std::integral_constant<int, Order> {}; /** \internal Specify the "storage kind" of multiplying an expression of kind A with kind B. * The template parameter ProductTag permits to specialize the resulting storage kind wrt to @@ -733,8 +714,8 @@ Array<Scalar, 1, ExpressionType::ColsAtCompileTime, int(ExpressionType::PlainObject::Options) | int(RowMajor), 1, ExpressionType::MaxColsAtCompileTime>; - using type = std::conditional_t<is_same<typename traits<ExpressionType>::XprKind, MatrixXpr>::value, MatrixRowType, - ArrayRowType>; + using type = std::conditional_t<std::is_same<typename traits<ExpressionType>::XprKind, MatrixXpr>::value, + MatrixRowType, ArrayRowType>; }; template <typename ExpressionType, typename Scalar = typename ExpressionType::Scalar> @@ -745,8 +726,8 @@ using ArrayColType = Array<Scalar, ExpressionType::RowsAtCompileTime, 1, ExpressionType::PlainObject::Options & ~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1>; - using type = std::conditional_t<is_same<typename traits<ExpressionType>::XprKind, MatrixXpr>::value, MatrixColType, - ArrayColType>; + using type = std::conditional_t<std::is_same<typename traits<ExpressionType>::XprKind, MatrixXpr>::value, + MatrixColType, ArrayColType>; }; template <typename ExpressionType, typename Scalar = typename ExpressionType::Scalar> @@ -759,8 +740,8 @@ Matrix<Scalar, diag_size, 1, ExpressionType::PlainObject::Options & ~RowMajor, max_diag_size, 1>; using ArrayDiagType = Array<Scalar, diag_size, 1, ExpressionType::PlainObject::Options & ~RowMajor, max_diag_size, 1>; - using type = std::conditional_t<is_same<typename traits<ExpressionType>::XprKind, MatrixXpr>::value, MatrixDiagType, - ArrayDiagType>; + using type = std::conditional_t<std::is_same<typename traits<ExpressionType>::XprKind, MatrixXpr>::value, + MatrixDiagType, ArrayDiagType>; }; template <typename Expr, typename Scalar = typename Expr::Scalar> @@ -773,45 +754,32 @@ using matrix_type = Matrix<Scalar, traits<Expr>::RowsAtCompileTime, traits<Expr>::ColsAtCompileTime, Options, traits<Expr>::MaxRowsAtCompileTime, traits<Expr>::MaxColsAtCompileTime>; - using type = CwiseNullaryOp< - scalar_constant_op<Scalar>, - const std::conditional_t<is_same<typename traits<Expr>::XprKind, MatrixXpr>::value, matrix_type, array_type>>; + using type = CwiseNullaryOp<scalar_constant_op<Scalar>, + const std::conditional_t<std::is_same<typename traits<Expr>::XprKind, MatrixXpr>::value, + matrix_type, array_type>>; }; template <typename ExpressionType> -struct is_lvalue { - enum { value = (!bool(is_const<ExpressionType>::value)) && bool(traits<ExpressionType>::Flags & LvalueBit) }; -}; +struct is_lvalue : std::integral_constant<bool, (!bool(std::is_const<ExpressionType>::value)) && + bool((traits<ExpressionType>::Flags & LvalueBit))> {}; template <typename T> -struct is_diagonal { - enum { ret = false }; -}; +struct is_diagonal : std::false_type {}; template <typename T> -struct is_diagonal<DiagonalBase<T>> { - enum { ret = true }; -}; +struct is_diagonal<DiagonalBase<T>> : std::true_type {}; template <typename T> -struct is_diagonal<DiagonalWrapper<T>> { - enum { ret = true }; -}; +struct is_diagonal<DiagonalWrapper<T>> : std::true_type {}; template <typename T, int S> -struct is_diagonal<DiagonalMatrix<T, S>> { - enum { ret = true }; -}; +struct is_diagonal<DiagonalMatrix<T, S>> : std::true_type {}; template <typename T> -struct is_identity { - enum { value = false }; -}; +struct is_identity : std::false_type {}; template <typename T> -struct is_identity<CwiseNullaryOp<internal::scalar_identity_op<typename T::Scalar>, T>> { - enum { value = true }; -}; +struct is_identity<CwiseNullaryOp<internal::scalar_identity_op<typename T::Scalar>, T>> : std::true_type {}; template <typename S1, typename S2> struct glue_shapes; @@ -821,12 +789,9 @@ }; template <typename T1, typename T2> -struct possibly_same_dense { - enum { - value = has_direct_access<T1>::ret && has_direct_access<T2>::ret && - is_same<typename T1::Scalar, typename T2::Scalar>::value - }; -}; +struct possibly_same_dense + : std::integral_constant<bool, has_direct_access<T1>::value && has_direct_access<T2>::value && + std::is_same<typename T1::Scalar, typename T2::Scalar>::value> {}; template <typename T1, typename T2> EIGEN_DEVICE_FUNC bool is_same_dense(const T1& mat1, const T2& mat2, @@ -843,27 +808,20 @@ // Internal helper defining the cost of a scalar division for the type T. // The default heuristic can be specialized for each scalar type and architecture. template <typename T, bool Vectorized = false, typename EnableIf = void> -struct scalar_div_cost { - enum { value = 8 * NumTraits<T>::MulCost }; -}; +struct scalar_div_cost : std::integral_constant<int, 8 * NumTraits<T>::MulCost> {}; template <typename T, bool Vectorized> -struct scalar_div_cost<T, Vectorized, std::enable_if_t<NumTraits<T>::IsComplex>> { - using RealScalar = typename NumTraits<T>::Real; - enum { - value = - 2 * scalar_div_cost<RealScalar>::value + 6 * NumTraits<RealScalar>::MulCost + 3 * NumTraits<RealScalar>::AddCost - }; -}; +struct scalar_div_cost<T, Vectorized, std::enable_if_t<NumTraits<T>::IsComplex>> + : std::integral_constant<int, 2 * scalar_div_cost<typename NumTraits<T>::Real>::value + + 6 * NumTraits<typename NumTraits<T>::Real>::MulCost + + 3 * NumTraits<typename NumTraits<T>::Real>::AddCost> {}; template <bool Vectorized> -struct scalar_div_cost<signed long, Vectorized, std::conditional_t<sizeof(long) == 8, void, false_type>> { - enum { value = 24 }; -}; +struct scalar_div_cost<signed long, Vectorized, std::conditional_t<sizeof(long) == 8, void, std::false_type>> + : std::integral_constant<int, 24> {}; template <bool Vectorized> -struct scalar_div_cost<unsigned long, Vectorized, std::conditional_t<sizeof(long) == 8, void, false_type>> { - enum { value = 21 }; -}; +struct scalar_div_cost<unsigned long, Vectorized, std::conditional_t<sizeof(long) == 8, void, std::false_type>> + : std::integral_constant<int, 21> {}; #ifdef EIGEN_DEBUG_ASSIGN std::string demangle_traversal(int t) {
diff --git a/Eigen/src/Geometry/AngleAxis.h b/Eigen/src/Geometry/AngleAxis.h index 273e163..4bc375f 100644 --- a/Eigen/src/Geometry/AngleAxis.h +++ b/Eigen/src/Geometry/AngleAxis.h
@@ -222,7 +222,7 @@ EIGEN_USING_STD(atan2) EIGEN_USING_STD(sqrt) EIGEN_STATIC_ASSERT( - (internal::is_same<Scalar, typename Derived::Scalar>::value), + (std::is_same<Scalar, typename Derived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) eigen_assert(mat.cols() == 3 && mat.rows() == 3);
diff --git a/Eigen/src/Geometry/OrthoMethods.h b/Eigen/src/Geometry/OrthoMethods.h index d018be9..d8f7304 100644 --- a/Eigen/src/Geometry/OrthoMethods.h +++ b/Eigen/src/Geometry/OrthoMethods.h
@@ -150,7 +150,7 @@ VectorwiseOp<ExpressionType, Direction>::cross(const MatrixBase<OtherDerived>& other) const { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived, 3) EIGEN_STATIC_ASSERT( - (internal::is_same<Scalar, typename OtherDerived::Scalar>::value), + (std::is_same<Scalar, typename OtherDerived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) typename internal::nested_eval<ExpressionType, 2>::type mat(_expression());
diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h index a967410..ba84e6a 100644 --- a/Eigen/src/Geometry/Quaternion.h +++ b/Eigen/src/Geometry/Quaternion.h
@@ -228,14 +228,12 @@ #else template <typename NewScalarType> - EIGEN_DEVICE_FUNC inline std::enable_if_t<internal::is_same<Scalar, NewScalarType>::value, const Derived&> cast() - const { + EIGEN_DEVICE_FUNC inline std::enable_if_t<std::is_same<Scalar, NewScalarType>::value, const Derived&> cast() const { return derived(); } template <typename NewScalarType> - EIGEN_DEVICE_FUNC inline std::enable_if_t<!internal::is_same<Scalar, NewScalarType>::value, - Quaternion<NewScalarType> > + EIGEN_DEVICE_FUNC inline std::enable_if_t<!std::is_same<Scalar, NewScalarType>::value, Quaternion<NewScalarType> > cast() const { return Quaternion<NewScalarType>(coeffs().template cast<NewScalarType>()); } @@ -555,7 +553,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion<typename internal::traits<Derived>::Scalar> QuaternionBase<Derived>::operator*(const QuaternionBase<OtherDerived>& other) const { EIGEN_STATIC_ASSERT( - (internal::is_same<typename Derived::Scalar, typename OtherDerived::Scalar>::value), + (std::is_same<typename Derived::Scalar, typename OtherDerived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) return internal::quat_product<Architecture::Target, Derived, OtherDerived, typename internal::traits<Derived>::Scalar>::run(*this, other); @@ -627,7 +625,7 @@ template <class MatrixDerived> EIGEN_DEVICE_FUNC inline Derived& QuaternionBase<Derived>::operator=(const MatrixBase<MatrixDerived>& xpr) { EIGEN_STATIC_ASSERT( - (internal::is_same<typename Derived::Scalar, typename MatrixDerived::Scalar>::value), + (std::is_same<typename Derived::Scalar, typename MatrixDerived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) internal::quaternionbase_assign_impl<MatrixDerived>::run(*this, xpr.derived()); return derived();
diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index e4740d5..beb8b66 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h
@@ -269,7 +269,7 @@ template <typename OtherDerived> EIGEN_DEVICE_FUNC inline explicit Transform(const EigenBase<OtherDerived>& other) { EIGEN_STATIC_ASSERT( - (internal::is_same<Scalar, typename OtherDerived::Scalar>::value), + (std::is_same<Scalar, typename OtherDerived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY); check_template_params(); @@ -280,7 +280,7 @@ template <typename OtherDerived> EIGEN_DEVICE_FUNC inline Transform& operator=(const EigenBase<OtherDerived>& other) { EIGEN_STATIC_ASSERT( - (internal::is_same<Scalar, typename OtherDerived::Scalar>::value), + (std::is_same<Scalar, typename OtherDerived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY); internal::transform_construct_from_matrix<OtherDerived, Mode, Options, Dim, HDim>::run(this, other.derived());
diff --git a/Eigen/src/Geometry/Umeyama.h b/Eigen/src/Geometry/Umeyama.h index e679088..ef589fa 100644 --- a/Eigen/src/Geometry/Umeyama.h +++ b/Eigen/src/Geometry/Umeyama.h
@@ -96,7 +96,7 @@ EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsComplex, NUMERIC_TYPE_MUST_BE_REAL) EIGEN_STATIC_ASSERT( - (internal::is_same<Scalar, typename internal::traits<OtherDerived>::Scalar>::value), + (std::is_same<Scalar, typename internal::traits<OtherDerived>::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) enum { Dimension = internal::min_size_prefer_dynamic(Derived::RowsAtCompileTime, OtherDerived::RowsAtCompileTime) };
diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index 97a07af..49740ff 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h
@@ -19,17 +19,11 @@ namespace internal { template <int N> -struct decrement_size { - static constexpr int ret = N - 1; -}; +struct decrement_size : std::integral_constant<int, N - 1> {}; template <> -struct decrement_size<0> { - static constexpr int ret = 0; -}; +struct decrement_size<0> : std::integral_constant<int, 0> {}; template <> -struct decrement_size<Dynamic> { - static constexpr int ret = Dynamic; -}; +struct decrement_size<Dynamic> : std::integral_constant<int, Dynamic> {}; } // namespace internal /** Computes the elementary reflector H such that: @@ -50,7 +44,8 @@ */ template <typename Derived> EIGEN_DEVICE_FUNC void MatrixBase<Derived>::makeHouseholderInPlace(Scalar& tau, RealScalar& beta) { - VectorBlock<Derived, internal::decrement_size<Base::SizeAtCompileTime>::ret> essentialPart(derived(), 1, size() - 1); + VectorBlock<Derived, internal::decrement_size<Base::SizeAtCompileTime>::value> essentialPart(derived(), 1, + size() - 1); makeHouseholder(essentialPart, tau, beta); }
diff --git a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h index 45d01ad..5184b23 100644 --- a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +++ b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h
@@ -18,37 +18,15 @@ namespace internal { -template <typename MatrixType> -struct is_ref_compatible_impl { - private: - template <typename T0> - struct any_conversion { - template <typename T> - any_conversion(const volatile T&); - template <typename T> - any_conversion(T&); - }; - struct yes { - int a[1]; - }; - struct no { - int a[2]; - }; - - template <typename T> - static yes test(const Ref<const T>&, int); - template <typename T> - static no test(any_conversion<T>, ...); - - public: - static MatrixType ms_from; - enum { value = sizeof(test<MatrixType>(ms_from, 0)) == sizeof(yes) }; -}; +template <typename T> +auto is_ref_compatible_test(T& matrix) -> decltype(Ref<const T>(matrix), std::true_type()); +std::false_type is_ref_compatible_test(...); template <typename MatrixType> -struct is_ref_compatible { - enum { value = is_ref_compatible_impl<remove_all_t<MatrixType>>::value }; -}; +struct is_ref_compatible_impl : decltype(is_ref_compatible_test(std::declval<MatrixType&>())) {}; + +template <typename MatrixType> +struct is_ref_compatible : std::integral_constant<bool, is_ref_compatible_impl<remove_all_t<MatrixType>>::value> {}; template <typename MatrixType, bool MatrixFree = !internal::is_ref_compatible<MatrixType>::value> class generic_matrix_wrapper;
diff --git a/Eigen/src/Jacobi/Jacobi.h b/Eigen/src/Jacobi/Jacobi.h index 35890c1..fd55d23 100644 --- a/Eigen/src/Jacobi/Jacobi.h +++ b/Eigen/src/Jacobi/Jacobi.h
@@ -77,8 +77,8 @@ EIGEN_DEVICE_FUNC void makeGivens(const Scalar& p, const Scalar& q, Scalar* r = 0); protected: - EIGEN_DEVICE_FUNC void makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::true_type); - EIGEN_DEVICE_FUNC void makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type); + EIGEN_DEVICE_FUNC void makeGivens(const Scalar& p, const Scalar& q, Scalar* r, std::true_type); + EIGEN_DEVICE_FUNC void makeGivens(const Scalar& p, const Scalar& q, Scalar* r, std::false_type); Scalar m_c, m_s; }; @@ -151,13 +151,12 @@ */ template <typename Scalar> EIGEN_DEVICE_FUNC void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r) { - makeGivens(p, q, r, std::conditional_t<NumTraits<Scalar>::IsComplex, internal::true_type, internal::false_type>()); + makeGivens(p, q, r, std::conditional_t<NumTraits<Scalar>::IsComplex, std::true_type, std::false_type>()); } // specialization for complexes template <typename Scalar> -EIGEN_DEVICE_FUNC void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, - internal::true_type) { +EIGEN_DEVICE_FUNC void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, std::true_type) { using numext::conj; using std::abs; using std::sqrt; @@ -206,7 +205,7 @@ // specialization for reals template <typename Scalar> EIGEN_DEVICE_FUNC void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, - internal::false_type) { + std::false_type) { using std::abs; using std::sqrt; if (numext::is_exactly_zero(q)) {
diff --git a/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h b/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h index 389b145..4e58af5 100644 --- a/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +++ b/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h
@@ -301,7 +301,7 @@ private: template <typename ResType, typename OtherDerived, - typename std::enable_if<(int(OtherDerived::Flags) & DirectAccessBit) == DirectAccessBit, int>::type = 0> + std::enable_if_t<(int(OtherDerived::Flags) & DirectAccessBit) == DirectAccessBit, int> = 0> void evalToImpl(ResType& res, const MatrixBase<OtherDerived>& otherExpr) const { cholmod_dense y_cd; cholmod_dense* x_cd; @@ -315,7 +315,7 @@ } template <typename ResType, typename OtherDerived, - typename std::enable_if<(int(OtherDerived::Flags) & DirectAccessBit) == 0, int>::type = 0> + std::enable_if_t<(int(OtherDerived::Flags) & DirectAccessBit) == 0, int> = 0> void evalToImpl(ResType& res, const MatrixBase<OtherDerived>& otherExpr) const { cholmod_dense y_cd; cholmod_dense* x_cd; @@ -344,7 +344,7 @@ } template <typename ResType, typename OtherScalar, int OtherOptions, typename OtherStorageIndex, - typename std::enable_if<internal::is_same<OtherStorageIndex, StorageIndex>::value, int>::type = 0> + std::enable_if_t<std::is_same<OtherStorageIndex, StorageIndex>::value, int> = 0> void evalToImpl(ResType& res, const SparseMatrix<OtherScalar, OtherOptions, OtherStorageIndex>& otherExpr) const { cholmod_sparse y_cs; cholmod_sparse* x_cs;
diff --git a/Eigen/src/SVD/JacobiSVD.h b/Eigen/src/SVD/JacobiSVD.h index 92cf4d7..78bd51a 100644 --- a/Eigen/src/SVD/JacobiSVD.h +++ b/Eigen/src/SVD/JacobiSVD.h
@@ -34,19 +34,18 @@ enum { PreconditionIfMoreColsThanRows, PreconditionIfMoreRowsThanCols }; template <typename MatrixType, int QRPreconditioner, int Case> -struct qr_preconditioner_should_do_anything { - enum { - a = MatrixType::RowsAtCompileTime != Dynamic && MatrixType::ColsAtCompileTime != Dynamic && - MatrixType::ColsAtCompileTime <= MatrixType::RowsAtCompileTime, - b = MatrixType::RowsAtCompileTime != Dynamic && MatrixType::ColsAtCompileTime != Dynamic && - MatrixType::RowsAtCompileTime <= MatrixType::ColsAtCompileTime, - ret = !((QRPreconditioner == NoQRPreconditioner) || (Case == PreconditionIfMoreColsThanRows && bool(a)) || - (Case == PreconditionIfMoreRowsThanCols && bool(b))) - }; -}; +struct qr_preconditioner_should_do_anything + : std::integral_constant<bool, + !((QRPreconditioner == NoQRPreconditioner) || + (Case == PreconditionIfMoreColsThanRows && MatrixType::RowsAtCompileTime != Dynamic && + MatrixType::ColsAtCompileTime != Dynamic && + MatrixType::ColsAtCompileTime <= MatrixType::RowsAtCompileTime) || + (Case == PreconditionIfMoreRowsThanCols && MatrixType::RowsAtCompileTime != Dynamic && + MatrixType::ColsAtCompileTime != Dynamic && + MatrixType::RowsAtCompileTime <= MatrixType::ColsAtCompileTime))> {}; template <typename MatrixType, int Options, int QRPreconditioner, int Case, - bool DoAnything = qr_preconditioner_should_do_anything<MatrixType, QRPreconditioner, Case>::ret> + bool DoAnything = qr_preconditioner_should_do_anything<MatrixType, QRPreconditioner, Case>::value> struct qr_preconditioner_impl {}; template <typename MatrixType, int Options, int QRPreconditioner, int Case>
diff --git a/Eigen/src/SVD/UpperBidiagonalization.h b/Eigen/src/SVD/UpperBidiagonalization.h index 64f4ed1..72ec297 100644 --- a/Eigen/src/SVD/UpperBidiagonalization.h +++ b/Eigen/src/SVD/UpperBidiagonalization.h
@@ -28,7 +28,7 @@ enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, - ColsAtCompileTimeMinusOne = internal::decrement_size<ColsAtCompileTime>::ret + ColsAtCompileTimeMinusOne = internal::decrement_size<ColsAtCompileTime>::value }; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar;
diff --git a/Eigen/src/SparseCholesky/SimplicialCholesky.h b/Eigen/src/SparseCholesky/SimplicialCholesky.h index 0f201b0..cb40e78 100644 --- a/Eigen/src/SparseCholesky/SimplicialCholesky.h +++ b/Eigen/src/SparseCholesky/SimplicialCholesky.h
@@ -867,10 +867,10 @@ const Index size = a.rows(); pmat = ≈ // Note that ordering methods compute the inverse permutation - if (!internal::is_same<OrderingType, NaturalOrdering<StorageIndex> >::value) { + if (!std::is_same<OrderingType, NaturalOrdering<StorageIndex> >::value) { { CholMatrixType C; - constexpr bool kUseAMDFastPath = internal::is_same<OrderingType, AMDOrdering<StorageIndex> >::value; + constexpr bool kUseAMDFastPath = std::is_same<OrderingType, AMDOrdering<StorageIndex> >::value; internal::simplicial_cholesky_amd_dispatch<kUseAMDFastPath>::template run<UpLo, NonHermitian, OrderingType>( a, C, m_Pinv); }
diff --git a/Eigen/src/SparseCore/SparseAssign.h b/Eigen/src/SparseCore/SparseAssign.h index 2852ebb..686abea 100644 --- a/Eigen/src/SparseCore/SparseAssign.h +++ b/Eigen/src/SparseCore/SparseAssign.h
@@ -144,8 +144,7 @@ template <typename DstXprType, typename SrcXprType, typename Functor, typename Weak> struct Assignment<DstXprType, SrcXprType, Functor, Sparse2Dense, Weak> { static void run(DstXprType &dst, const SrcXprType &src, const Functor &func) { - if (internal::is_same<Functor, - internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>>::value) + if (std::is_same<Functor, internal::assign_op<typename DstXprType::Scalar, typename SrcXprType::Scalar>>::value) dst.setZero(); internal::evaluator<SrcXprType> srcEval(src); @@ -176,7 +175,7 @@ // Specialization for dense1 = sparse + dense2; -> dense1 = dense2; dense1 += sparse; template <typename Lhs, typename Rhs, typename Scalar> static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE - std::enable_if_t<internal::is_same<typename internal::evaluator_traits<Rhs>::Shape, DenseShape>::value> + std::enable_if_t<std::is_same<typename internal::evaluator_traits<Rhs>::Shape, DenseShape>::value> run(DstXprType &dst, const CwiseBinaryOp<internal::scalar_sum_op<Scalar, Scalar>, const Lhs, const Rhs> &src, const internal::assign_op<typename DstXprType::Scalar, Scalar> & /*func*/) { #ifdef EIGEN_SPARSE_ASSIGNMENT_FROM_SPARSE_ADD_DENSE_PLUGIN @@ -191,7 +190,7 @@ // Specialization for dense1 = sparse - dense2; -> dense1 = -dense2; dense1 += sparse; template <typename Lhs, typename Rhs, typename Scalar> static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE - std::enable_if_t<internal::is_same<typename internal::evaluator_traits<Rhs>::Shape, DenseShape>::value> + std::enable_if_t<std::is_same<typename internal::evaluator_traits<Rhs>::Shape, DenseShape>::value> run(DstXprType &dst, const CwiseBinaryOp<internal::scalar_difference_op<Scalar, Scalar>, const Lhs, const Rhs> &src, const internal::assign_op<typename DstXprType::Scalar, Scalar> & /*func*/) { @@ -210,8 +209,8 @@ struct Assignment< \ DstXprType, CwiseBinaryOp<internal::BINOP<Scalar, Scalar>, const Lhs, const Rhs>, \ internal::ASSIGN_OP<typename DstXprType::Scalar, Scalar>, Sparse2Dense, \ - std::enable_if_t<internal::is_same<typename internal::evaluator_traits<Lhs>::Shape, DenseShape>::value || \ - internal::is_same<typename internal::evaluator_traits<Rhs>::Shape, DenseShape>::value>> \ + std::enable_if_t<std::is_same<typename internal::evaluator_traits<Lhs>::Shape, DenseShape>::value || \ + std::is_same<typename internal::evaluator_traits<Rhs>::Shape, DenseShape>::value>> \ : assignment_from_dense_op_sparse<DstXprType, \ internal::ASSIGN_OP<typename DstXprType::Scalar, typename Lhs::Scalar>, \ internal::ASSIGN_OP2<typename DstXprType::Scalar, typename Rhs::Scalar>> {}
diff --git a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h index 1505c26..4dd3a34 100644 --- a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +++ b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h
@@ -42,8 +42,8 @@ typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived; typedef SparseMatrixBase<Derived> Base; EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) - EIGEN_STATIC_ASSERT(((!internal::is_same<typename internal::traits<Lhs>::StorageKind, - typename internal::traits<Rhs>::StorageKind>::value) || + EIGEN_STATIC_ASSERT(((!std::is_same<typename internal::traits<Lhs>::StorageKind, + typename internal::traits<Rhs>::StorageKind>::value) || ((internal::evaluator<Lhs>::Flags & RowMajorBit) == (internal::evaluator<Rhs>::Flags & RowMajorBit))), THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH)
diff --git a/Eigen/src/SparseCore/SparseDenseProduct.h b/Eigen/src/SparseCore/SparseDenseProduct.h index b02d4f7..3bd724b 100644 --- a/Eigen/src/SparseCore/SparseDenseProduct.h +++ b/Eigen/src/SparseCore/SparseDenseProduct.h
@@ -403,10 +403,10 @@ // if the actual left-hand side is a dense vector, // then build a sparse-view so that we can seamlessly iterate over it. - typedef std::conditional_t<is_same<typename internal::traits<Lhs1>::StorageKind, Sparse>::value, Lhs1, + typedef std::conditional_t<std::is_same<typename internal::traits<Lhs1>::StorageKind, Sparse>::value, Lhs1, SparseView<Lhs1> > ActualLhs; - typedef std::conditional_t<is_same<typename internal::traits<Lhs1>::StorageKind, Sparse>::value, Lhs1 const&, + typedef std::conditional_t<std::is_same<typename internal::traits<Lhs1>::StorageKind, Sparse>::value, Lhs1 const&, SparseView<Lhs1> > LhsArg;
diff --git a/Eigen/src/SparseCore/SparseDot.h b/Eigen/src/SparseCore/SparseDot.h index d3c9c80..4471036 100644 --- a/Eigen/src/SparseCore/SparseDot.h +++ b/Eigen/src/SparseCore/SparseDot.h
@@ -24,7 +24,7 @@ EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived, OtherDerived) EIGEN_STATIC_ASSERT( - (internal::is_same<Scalar, typename OtherDerived::Scalar>::value), + (std::is_same<Scalar, typename OtherDerived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) eigen_assert(size() == other.size()); @@ -54,7 +54,7 @@ EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived, OtherDerived) EIGEN_STATIC_ASSERT( - (internal::is_same<Scalar, typename OtherDerived::Scalar>::value), + (std::is_same<Scalar, typename OtherDerived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) eigen_assert(size() == other.size());
diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h index 4634639..b85d1ad 100644 --- a/Eigen/src/SparseCore/SparseMatrix.h +++ b/Eigen/src/SparseCore/SparseMatrix.h
@@ -776,7 +776,7 @@ inline SparseMatrix(const SparseMatrixBase<OtherDerived>& other) : m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { EIGEN_STATIC_ASSERT( - (internal::is_same<Scalar, typename OtherDerived::Scalar>::value), + (std::is_same<Scalar, typename OtherDerived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) const bool needToTranspose = (Flags & RowMajorBit) != (internal::evaluator<OtherDerived>::Flags & RowMajorBit); if (needToTranspose) @@ -1007,7 +1007,7 @@ Index n = diagXpr.size(); - const bool overwrite = internal::is_same<Func, internal::assign_op<Scalar, Scalar>>::value; + const bool overwrite = std::is_same<Func, internal::assign_op<Scalar, Scalar>>::value; if (overwrite) { if ((m_outerSize != n) || (m_innerSize != n) || (n == 0)) resize(n, n); } @@ -1526,7 +1526,7 @@ EIGEN_DONT_INLINE SparseMatrix<Scalar, Options_, StorageIndex_>& SparseMatrix<Scalar, Options_, StorageIndex_>::operator=(const SparseMatrixBase<OtherDerived>& other) { EIGEN_STATIC_ASSERT( - (internal::is_same<Scalar, typename OtherDerived::Scalar>::value), + (std::is_same<Scalar, typename OtherDerived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
diff --git a/Eigen/src/SparseCore/SparseMatrixBase.h b/Eigen/src/SparseCore/SparseMatrixBase.h index 3aa6fec..e96c640 100644 --- a/Eigen/src/SparseCore/SparseMatrixBase.h +++ b/Eigen/src/SparseCore/SparseMatrixBase.h
@@ -69,7 +69,7 @@ * it is set to the \a Dynamic constant. * \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */ - SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::ret), + SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::value), /**< This is equal to the number of coefficients, i.e. the number of * rows times the number of columns, or to \a Dynamic if this is not * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
diff --git a/Eigen/src/SparseCore/SparsePermutation.h b/Eigen/src/SparseCore/SparsePermutation.h index d5ec2f7..8efb006 100644 --- a/Eigen/src/SparseCore/SparsePermutation.h +++ b/Eigen/src/SparseCore/SparsePermutation.h
@@ -21,7 +21,7 @@ namespace internal { template <typename ExpressionType, typename PlainObjectType, - bool NeedEval = !is_same<ExpressionType, PlainObjectType>::value> + bool NeedEval = !std::is_same<ExpressionType, PlainObjectType>::value> struct XprHelper { XprHelper(const ExpressionType& xpr) : m_xpr(xpr) {} inline const PlainObjectType& xpr() const { return m_xpr; }
diff --git a/Eigen/src/SparseCore/SparseProduct.h b/Eigen/src/SparseCore/SparseProduct.h index 5c5a3fc..d26a8b2 100644 --- a/Eigen/src/SparseCore/SparseProduct.h +++ b/Eigen/src/SparseCore/SparseProduct.h
@@ -46,8 +46,9 @@ // dense += sparse * sparse template <typename Dest, typename ActualLhs> - static void addTo(Dest& dst, const ActualLhs& lhs, const Rhs& rhs, - std::enable_if_t<is_same<typename evaluator_traits<Dest>::Shape, DenseShape>::value, int*>* = 0) { + static void addTo( + Dest& dst, const ActualLhs& lhs, const Rhs& rhs, + std::enable_if_t<std::is_same<typename evaluator_traits<Dest>::Shape, DenseShape>::value, int*>* = 0) { typedef typename nested_eval<ActualLhs, Dynamic>::type LhsNested; typedef typename nested_eval<Rhs, Dynamic>::type RhsNested; LhsNested lhsNested(lhs); @@ -58,8 +59,9 @@ // dense -= sparse * sparse template <typename Dest> - static void subTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, - std::enable_if_t<is_same<typename evaluator_traits<Dest>::Shape, DenseShape>::value, int*>* = 0) { + static void subTo( + Dest& dst, const Lhs& lhs, const Rhs& rhs, + std::enable_if_t<std::is_same<typename evaluator_traits<Dest>::Shape, DenseShape>::value, int*>* = 0) { addTo(dst, -lhs, rhs); }
diff --git a/Eigen/src/SparseCore/SparseRef.h b/Eigen/src/SparseCore/SparseRef.h index ef773a5..78cf92f 100644 --- a/Eigen/src/SparseCore/SparseRef.h +++ b/Eigen/src/SparseCore/SparseRef.h
@@ -39,7 +39,7 @@ ((PlainObjectType::Flags & RowMajorBit) == (Derived::Flags & RowMajorBit)), MatchAtCompileTime = (Derived::Flags & CompressedAccessBit) && StorageOrderMatch }; - typedef std::conditional_t<MatchAtCompileTime, internal::true_type, internal::false_type> type; + typedef std::conditional_t<MatchAtCompileTime, std::true_type, std::false_type> type; }; }; @@ -61,7 +61,7 @@ template <typename Derived> struct match { enum { MatchAtCompileTime = (Derived::Flags & CompressedAccessBit) && Derived::IsVectorAtCompileTime }; - typedef std::conditional_t<MatchAtCompileTime, internal::true_type, internal::false_type> type; + typedef std::conditional_t<MatchAtCompileTime, std::true_type, std::false_type> type; }; }; @@ -208,7 +208,7 @@ protected: template <typename Expression> - void construct(const Expression& expr, internal::true_type) { + void construct(const Expression& expr, std::true_type) { if ((Options & int(StandardCompressedFormat)) && (!expr.isCompressed())) { TPlainObjectType* obj = internal::construct_at(reinterpret_cast<TPlainObjectType*>(&m_storage), expr); m_hasCopy = true; @@ -219,7 +219,7 @@ } template <typename Expression> - void construct(const Expression& expr, internal::false_type) { + void construct(const Expression& expr, std::false_type) { TPlainObjectType* obj = internal::construct_at(reinterpret_cast<TPlainObjectType*>(&m_storage), expr); m_hasCopy = true; Base::construct(*obj); @@ -316,12 +316,12 @@ protected: template <typename Expression> - void construct(const Expression& expr, internal::true_type) { + void construct(const Expression& expr, std::true_type) { Base::construct(expr); } template <typename Expression> - void construct(const Expression& expr, internal::false_type) { + void construct(const Expression& expr, std::false_type) { TPlainObjectType* obj = internal::construct_at(reinterpret_cast<TPlainObjectType*>(&m_storage), expr); m_hasCopy = true; Base::construct(*obj);
diff --git a/Eigen/src/SparseCore/SparseTriangularView.h b/Eigen/src/SparseCore/SparseTriangularView.h index eb897f6..0b2289a 100644 --- a/Eigen/src/SparseCore/SparseTriangularView.h +++ b/Eigen/src/SparseCore/SparseTriangularView.h
@@ -54,7 +54,7 @@ template <typename RhsType, typename DstType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _solve_impl(const RhsType& rhs, DstType& dst) const { - if (!(internal::is_same<RhsType, DstType>::value && internal::extract_data(dst) == internal::extract_data(rhs))) + if (!(std::is_same<RhsType, DstType>::value && internal::extract_data(dst) == internal::extract_data(rhs))) dst = rhs; this->solveInPlace(dst); }
diff --git a/Eigen/src/SuperLUSupport/SuperLUSupport.h b/Eigen/src/SuperLUSupport/SuperLUSupport.h index 5f5343f..38ab871 100644 --- a/Eigen/src/SuperLUSupport/SuperLUSupport.h +++ b/Eigen/src/SuperLUSupport/SuperLUSupport.h
@@ -155,13 +155,13 @@ template <typename Scalar> void setScalarType() { - if (internal::is_same<Scalar, float>::value) + if (std::is_same<Scalar, float>::value) Dtype = SLU_S; - else if (internal::is_same<Scalar, double>::value) + else if (std::is_same<Scalar, double>::value) Dtype = SLU_D; - else if (internal::is_same<Scalar, std::complex<float> >::value) + else if (std::is_same<Scalar, std::complex<float> >::value) Dtype = SLU_C; - else if (internal::is_same<Scalar, std::complex<double> >::value) + else if (std::is_same<Scalar, std::complex<double> >::value) Dtype = SLU_Z; else { eigen_assert(false && "Scalar type not supported by SuperLU");
diff --git a/test/array_cwise.cpp b/test/array_cwise.cpp index af4a1a5..1cf36c2 100644 --- a/test/array_cwise.cpp +++ b/test/array_cwise.cpp
@@ -1427,9 +1427,9 @@ CALL_SUBTEST_33((cast_test<Dynamic, 1>())); } - VERIFY((internal::is_same<internal::global_math_functions_filtering_base<int>::type, int>::value)); - VERIFY((internal::is_same<internal::global_math_functions_filtering_base<float>::type, float>::value)); - VERIFY((internal::is_same<internal::global_math_functions_filtering_base<Array2i>::type, ArrayBase<Array2i>>::value)); + VERIFY((std::is_same<internal::global_math_functions_filtering_base<int>::type, int>::value)); + VERIFY((std::is_same<internal::global_math_functions_filtering_base<float>::type, float>::value)); + VERIFY((std::is_same<internal::global_math_functions_filtering_base<Array2i>::type, ArrayBase<Array2i>>::value)); typedef CwiseUnaryOp<internal::scalar_abs_op<double>, ArrayXd> Xpr; - VERIFY((internal::is_same<internal::global_math_functions_filtering_base<Xpr>::type, ArrayBase<Xpr>>::value)); + VERIFY((std::is_same<internal::global_math_functions_filtering_base<Xpr>::type, ArrayBase<Xpr>>::value)); }
diff --git a/test/block.cpp b/test/block.cpp index ae30445..baf5e20 100644 --- a/test/block.cpp +++ b/test/block.cpp
@@ -33,7 +33,7 @@ // Check at compile-time that T1==T2, and at runtime-time that a==b template <typename T1, typename T2> -std::enable_if_t<internal::is_same<T1, T2>::value, bool> is_same_block(const T1& a, const T2& b) { +std::enable_if_t<std::is_same<T1, T2>::value, bool> is_same_block(const T1& a, const T2& b) { return a.isApprox(b); }
diff --git a/test/cholesky.cpp b/test/cholesky.cpp index d2e3891..a5aa8dd 100644 --- a/test/cholesky.cpp +++ b/test/cholesky.cpp
@@ -76,8 +76,8 @@ } { - STATIC_CHECK((internal::is_same<typename LLT<MatrixType, Lower>::StorageIndex, int>::value)); - STATIC_CHECK((internal::is_same<typename LLT<MatrixType, Upper>::StorageIndex, int>::value)); + STATIC_CHECK((std::is_same<typename LLT<MatrixType, Lower>::StorageIndex, int>::value)); + STATIC_CHECK((std::is_same<typename LLT<MatrixType, Upper>::StorageIndex, int>::value)); SquareMatrixType symmUp = symm.template triangularView<Upper>(); SquareMatrixType symmLo = symm.template triangularView<Lower>(); @@ -139,8 +139,8 @@ // LDLT { - STATIC_CHECK((internal::is_same<typename LDLT<MatrixType, Lower>::StorageIndex, int>::value)); - STATIC_CHECK((internal::is_same<typename LDLT<MatrixType, Upper>::StorageIndex, int>::value)); + STATIC_CHECK((std::is_same<typename LDLT<MatrixType, Lower>::StorageIndex, int>::value)); + STATIC_CHECK((std::is_same<typename LDLT<MatrixType, Upper>::StorageIndex, int>::value)); int sign = internal::random<int>() % 2 ? 1 : -1;
diff --git a/test/eigensolver_generic.cpp b/test/eigensolver_generic.cpp index 8cb5707..47105ed 100644 --- a/test/eigensolver_generic.cpp +++ b/test/eigensolver_generic.cpp
@@ -17,7 +17,7 @@ void check_eigensolver_for_given_mat(const EigType& eig, const MatType& a) { typedef typename NumTraits<typename MatType::Scalar>::Real RealScalar; typedef Matrix<RealScalar, MatType::RowsAtCompileTime, 1> RealVectorType; - typedef typename std::complex<RealScalar> Complex; + typedef std::complex<RealScalar> Complex; Index n = a.rows(); VERIFY_IS_EQUAL(eig.info(), Success); VERIFY_IS_APPROX(a * eig.pseudoEigenvectors(), eig.pseudoEigenvectors() * eig.pseudoEigenvalueMatrix()); @@ -37,7 +37,7 @@ typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; - typedef typename std::complex<RealScalar> Complex; + typedef std::complex<RealScalar> Complex; MatrixType a = MatrixType::Random(rows, cols); MatrixType a1 = MatrixType::Random(rows, cols);
diff --git a/test/geo_quaternion.cpp b/test/geo_quaternion.cpp index 40fc7ff..ab593a6 100644 --- a/test/geo_quaternion.cpp +++ b/test/geo_quaternion.cpp
@@ -148,7 +148,7 @@ VERIFY_IS_APPROX(v2.normalized(), (q2.setFromTwoVectors(v1, v2) * v1).normalized()); VERIFY_IS_APPROX(v1.normalized(), (q2.setFromTwoVectors(v1, v1) * v1).normalized()); VERIFY_IS_APPROX(-v1.normalized(), (q2.setFromTwoVectors(v1, -v1) * v1).normalized()); - if (internal::is_same<Scalar, double>::value) { + if (std::is_same<Scalar, double>::value) { v3 = (v1.array() + eps).matrix(); VERIFY_IS_APPROX(v3.normalized(), (q2.setFromTwoVectors(v1, v3) * v1).normalized()); VERIFY_IS_APPROX(-v3.normalized(), (q2.setFromTwoVectors(v1, -v3) * v1).normalized()); @@ -158,7 +158,7 @@ VERIFY_IS_APPROX(v2.normalized(), (Quaternionx::FromTwoVectors(v1, v2) * v1).normalized()); VERIFY_IS_APPROX(v1.normalized(), (Quaternionx::FromTwoVectors(v1, v1) * v1).normalized()); VERIFY_IS_APPROX(-v1.normalized(), (Quaternionx::FromTwoVectors(v1, -v1) * v1).normalized()); - if (internal::is_same<Scalar, double>::value) { + if (std::is_same<Scalar, double>::value) { v3 = (v1.array() + eps).matrix(); VERIFY_IS_APPROX(v3.normalized(), (Quaternionx::FromTwoVectors(v1, v3) * v1).normalized()); VERIFY_IS_APPROX(-v3.normalized(), (Quaternionx::FromTwoVectors(v1, -v3) * v1).normalized());
diff --git a/test/householder.cpp b/test/householder.cpp index 1999576..916709a 100644 --- a/test/householder.cpp +++ b/test/householder.cpp
@@ -24,7 +24,7 @@ typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType; - typedef Matrix<Scalar, internal::decrement_size<MatrixType::RowsAtCompileTime>::ret, 1> EssentialVectorType; + typedef Matrix<Scalar, internal::decrement_size<MatrixType::RowsAtCompileTime>::value, 1> EssentialVectorType; typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType; typedef Matrix<Scalar, Dynamic, MatrixType::ColsAtCompileTime> HBlockMatrixType; typedef Matrix<Scalar, Dynamic, 1> HCoeffsVectorType;
diff --git a/test/indexed_view.cpp b/test/indexed_view.cpp index 6976ceb..b80d834 100644 --- a/test/indexed_view.cpp +++ b/test/indexed_view.cpp
@@ -38,7 +38,7 @@ #define MATCH(X, R) match(X, R, #X) template <typename T1, typename T2> -std::enable_if_t<internal::is_same<T1, T2>::value, bool> is_same_eq(const T1& a, const T2& b) { +std::enable_if_t<std::is_same<T1, T2>::value, bool> is_same_eq(const T1& a, const T2& b) { return (a == b).all(); } @@ -54,7 +54,7 @@ } template <typename T1, typename T2> -std::enable_if_t<internal::is_same<T1, T2>::value, bool> is_same_seq_type(const T1& a, const T2& b) { +std::enable_if_t<std::is_same<T1, T2>::value, bool> is_same_seq_type(const T1& a, const T2& b) { return is_same_seq(a, b); }
diff --git a/test/linearstructure.cpp b/test/linearstructure.cpp index 581db38..7a293b8 100644 --- a/test/linearstructure.cpp +++ b/test/linearstructure.cpp
@@ -11,7 +11,7 @@ static bool g_called; #define EIGEN_SCALAR_BINARY_OP_PLUGIN \ - { g_called |= (!internal::is_same<LhsScalar, RhsScalar>::value); } + { g_called |= (!std::is_same<LhsScalar, RhsScalar>::value); } #include "main.h"
diff --git a/test/main.h b/test/main.h index 65dbb34..0bc1925 100644 --- a/test/main.h +++ b/test/main.h
@@ -402,7 +402,7 @@ namespace Eigen { template <typename T1, typename T2> -std::enable_if_t<internal::is_same<T1, T2>::value, bool> is_same_type(const T1&, const T2&) { +std::enable_if_t<std::is_same<T1, T2>::value, bool> is_same_type(const T1&, const T2&) { return true; }
diff --git a/test/meta.cpp b/test/meta.cpp index 2695779..23217f4 100644 --- a/test/meta.cpp +++ b/test/meta.cpp
@@ -13,11 +13,6 @@ #include <array> #include <Eigen/src/Core/util/Meta.h> -template <typename From, typename To> -bool check_is_convertible(const From&, const To&) { - return internal::is_convertible<From, To>::value; -} - struct FooReturnType { typedef int ReturnType; }; @@ -34,36 +29,21 @@ using Eigen::internal::apply_op_from_right; using Eigen::internal::arg_prod; using Eigen::internal::arg_sum; -using Eigen::internal::array_apply; -using Eigen::internal::array_apply_and_reduce; using Eigen::internal::array_prod; using Eigen::internal::array_reduce; -using Eigen::internal::array_reverse; using Eigen::internal::array_sum; -using Eigen::internal::array_zip; -using Eigen::internal::array_zip_and_reduce; using Eigen::internal::concat; using Eigen::internal::contained_in_list; using Eigen::internal::contained_in_list_gf; -using Eigen::internal::gen_numeric_list; -using Eigen::internal::gen_numeric_list_repeated; -using Eigen::internal::gen_numeric_list_reversed; -using Eigen::internal::gen_numeric_list_swapped_pair; // Eigen::internal::get is intentionally left fully-qualified below: test/main.h // does `using namespace Eigen;`, and Eigen/src/Core/StructuredBindings.h defines // free functions `Eigen::get` that would otherwise clash with this metafunction. using Eigen::internal::id_numeric; using Eigen::internal::id_type; -using Eigen::internal::instantiate_by_c_array; -using Eigen::internal::is_same; using Eigen::internal::is_same_gf; using Eigen::internal::mconcat; -using Eigen::internal::numeric_list; -using Eigen::internal::product_op; -using Eigen::internal::repeat; using Eigen::internal::skip; using Eigen::internal::slice; -using Eigen::internal::sum_op; using Eigen::internal::take; using Eigen::internal::type_list; @@ -134,168 +114,64 @@ constexpr static int global_flags = 4; }; -struct times2_op { - template <typename A> - static A run(A v) { - return v * 2; - } -}; - -struct dummy_inst { - int c; - - dummy_inst() : c(0) {} - explicit dummy_inst(int) : c(1) {} - dummy_inst(int, int) : c(2) {} - dummy_inst(int, int, int) : c(3) {} - dummy_inst(int, int, int, int) : c(4) {} - dummy_inst(int, int, int, int, int) : c(5) {} -}; - -static void test_gen_numeric_list() { - VERIFY((is_same<typename gen_numeric_list<int, 0>::type, numeric_list<int>>::value)); - VERIFY((is_same<typename gen_numeric_list<int, 1>::type, numeric_list<int, 0>>::value)); - VERIFY((is_same<typename gen_numeric_list<int, 2>::type, numeric_list<int, 0, 1>>::value)); - VERIFY((is_same<typename gen_numeric_list<int, 5>::type, numeric_list<int, 0, 1, 2, 3, 4>>::value)); - VERIFY((is_same<typename gen_numeric_list<int, 10>::type, numeric_list<int, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9>>::value)); - - VERIFY((is_same<typename gen_numeric_list<int, 0, 42>::type, numeric_list<int>>::value)); - VERIFY((is_same<typename gen_numeric_list<int, 1, 42>::type, numeric_list<int, 42>>::value)); - VERIFY((is_same<typename gen_numeric_list<int, 2, 42>::type, numeric_list<int, 42, 43>>::value)); - VERIFY((is_same<typename gen_numeric_list<int, 5, 42>::type, numeric_list<int, 42, 43, 44, 45, 46>>::value)); - VERIFY((is_same<typename gen_numeric_list<int, 10, 42>::type, - numeric_list<int, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51>>::value)); - - VERIFY((is_same<typename gen_numeric_list_reversed<int, 0>::type, numeric_list<int>>::value)); - VERIFY((is_same<typename gen_numeric_list_reversed<int, 1>::type, numeric_list<int, 0>>::value)); - VERIFY((is_same<typename gen_numeric_list_reversed<int, 2>::type, numeric_list<int, 1, 0>>::value)); - VERIFY((is_same<typename gen_numeric_list_reversed<int, 5>::type, numeric_list<int, 4, 3, 2, 1, 0>>::value)); - VERIFY((is_same<typename gen_numeric_list_reversed<int, 10>::type, - numeric_list<int, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0>>::value)); - - VERIFY((is_same<typename gen_numeric_list_reversed<int, 0, 42>::type, numeric_list<int>>::value)); - VERIFY((is_same<typename gen_numeric_list_reversed<int, 1, 42>::type, numeric_list<int, 42>>::value)); - VERIFY((is_same<typename gen_numeric_list_reversed<int, 2, 42>::type, numeric_list<int, 43, 42>>::value)); - VERIFY((is_same<typename gen_numeric_list_reversed<int, 5, 42>::type, numeric_list<int, 46, 45, 44, 43, 42>>::value)); - VERIFY((is_same<typename gen_numeric_list_reversed<int, 10, 42>::type, - numeric_list<int, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42>>::value)); - - VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 0, 2, 3>::type, numeric_list<int>>::value)); - VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 1, 2, 3>::type, numeric_list<int, 0>>::value)); - VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 2, 2, 3>::type, numeric_list<int, 0, 1>>::value)); - VERIFY( - (is_same<typename gen_numeric_list_swapped_pair<int, 5, 2, 3>::type, numeric_list<int, 0, 1, 3, 2, 4>>::value)); - VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 10, 2, 3>::type, - numeric_list<int, 0, 1, 3, 2, 4, 5, 6, 7, 8, 9>>::value)); - - VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 0, 44, 45, 42>::type, numeric_list<int>>::value)); - VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 1, 44, 45, 42>::type, numeric_list<int, 42>>::value)); - VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 2, 44, 45, 42>::type, numeric_list<int, 42, 43>>::value)); - VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 5, 44, 45, 42>::type, - numeric_list<int, 42, 43, 45, 44, 46>>::value)); - VERIFY((is_same<typename gen_numeric_list_swapped_pair<int, 10, 44, 45, 42>::type, - numeric_list<int, 42, 43, 45, 44, 46, 47, 48, 49, 50, 51>>::value)); - - VERIFY((is_same<typename gen_numeric_list_repeated<int, 0, 0>::type, numeric_list<int>>::value)); - VERIFY((is_same<typename gen_numeric_list_repeated<int, 1, 0>::type, numeric_list<int, 0>>::value)); - VERIFY((is_same<typename gen_numeric_list_repeated<int, 2, 0>::type, numeric_list<int, 0, 0>>::value)); - VERIFY((is_same<typename gen_numeric_list_repeated<int, 5, 0>::type, numeric_list<int, 0, 0, 0, 0, 0>>::value)); - VERIFY((is_same<typename gen_numeric_list_repeated<int, 10, 0>::type, - numeric_list<int, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>::value)); -} - static void test_concat() { - VERIFY( - (is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<>>::type, type_list<dummy_a, dummy_a>>::value)); - VERIFY( - (is_same<typename concat<type_list<>, type_list<dummy_a, dummy_a>>::type, type_list<dummy_a, dummy_a>>::value)); - VERIFY((is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<dummy_a, dummy_a>>::type, - type_list<dummy_a, dummy_a, dummy_a, dummy_a>>::value)); - VERIFY((is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<dummy_b, dummy_c>>::type, - type_list<dummy_a, dummy_a, dummy_b, dummy_c>>::value)); - VERIFY((is_same<typename concat<type_list<dummy_a>, type_list<dummy_b, dummy_c>>::type, - type_list<dummy_a, dummy_b, dummy_c>>::value)); + VERIFY((std::is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<>>::type, + type_list<dummy_a, dummy_a>>::value)); + VERIFY((std::is_same<typename concat<type_list<>, type_list<dummy_a, dummy_a>>::type, + type_list<dummy_a, dummy_a>>::value)); + VERIFY((std::is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<dummy_a, dummy_a>>::type, + type_list<dummy_a, dummy_a, dummy_a, dummy_a>>::value)); + VERIFY((std::is_same<typename concat<type_list<dummy_a, dummy_a>, type_list<dummy_b, dummy_c>>::type, + type_list<dummy_a, dummy_a, dummy_b, dummy_c>>::value)); + VERIFY((std::is_same<typename concat<type_list<dummy_a>, type_list<dummy_b, dummy_c>>::type, + type_list<dummy_a, dummy_b, dummy_c>>::value)); - VERIFY((is_same<typename concat<numeric_list<int, 0, 0>, numeric_list<int>>::type, numeric_list<int, 0, 0>>::value)); - VERIFY((is_same<typename concat<numeric_list<int>, numeric_list<int, 0, 0>>::type, numeric_list<int, 0, 0>>::value)); - VERIFY((is_same<typename concat<numeric_list<int, 0, 0>, numeric_list<int, 0, 0>>::type, - numeric_list<int, 0, 0, 0, 0>>::value)); - VERIFY((is_same<typename concat<numeric_list<int, 0, 0>, numeric_list<int, 1, 2>>::type, - numeric_list<int, 0, 0, 1, 2>>::value)); - VERIFY((is_same<typename concat<numeric_list<int, 0>, numeric_list<int, 1, 2>>::type, - numeric_list<int, 0, 1, 2>>::value)); - - VERIFY((is_same<typename mconcat<type_list<dummy_a>>::type, type_list<dummy_a>>::value)); - VERIFY((is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b>>::type, type_list<dummy_a, dummy_b>>::value)); - VERIFY((is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b>, type_list<dummy_c>>::type, - type_list<dummy_a, dummy_b, dummy_c>>::value)); - VERIFY((is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b, dummy_c>>::type, - type_list<dummy_a, dummy_b, dummy_c>>::value)); - VERIFY((is_same<typename mconcat<type_list<dummy_a, dummy_b>, type_list<dummy_c>>::type, - type_list<dummy_a, dummy_b, dummy_c>>::value)); - - VERIFY((is_same<typename mconcat<numeric_list<int, 0>>::type, numeric_list<int, 0>>::value)); - VERIFY((is_same<typename mconcat<numeric_list<int, 0>, numeric_list<int, 1>>::type, numeric_list<int, 0, 1>>::value)); - VERIFY((is_same<typename mconcat<numeric_list<int, 0>, numeric_list<int, 1>, numeric_list<int, 2>>::type, - numeric_list<int, 0, 1, 2>>::value)); - VERIFY((is_same<typename mconcat<numeric_list<int, 0>, numeric_list<int, 1, 2>>::type, - numeric_list<int, 0, 1, 2>>::value)); - VERIFY((is_same<typename mconcat<numeric_list<int, 0, 1>, numeric_list<int, 2>>::type, - numeric_list<int, 0, 1, 2>>::value)); + VERIFY((std::is_same<typename mconcat<type_list<dummy_a>>::type, type_list<dummy_a>>::value)); + VERIFY((std::is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b>>::type, + type_list<dummy_a, dummy_b>>::value)); + VERIFY((std::is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b>, type_list<dummy_c>>::type, + type_list<dummy_a, dummy_b, dummy_c>>::value)); + VERIFY((std::is_same<typename mconcat<type_list<dummy_a>, type_list<dummy_b, dummy_c>>::type, + type_list<dummy_a, dummy_b, dummy_c>>::value)); + VERIFY((std::is_same<typename mconcat<type_list<dummy_a, dummy_b>, type_list<dummy_c>>::type, + type_list<dummy_a, dummy_b, dummy_c>>::value)); } static void test_slice() { typedef type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c> tl; - typedef numeric_list<int, 0, 1, 2, 3, 4, 5> il; - VERIFY((is_same<typename take<0, tl>::type, type_list<>>::value)); - VERIFY((is_same<typename take<1, tl>::type, type_list<dummy_a>>::value)); - VERIFY((is_same<typename take<2, tl>::type, type_list<dummy_a, dummy_a>>::value)); - VERIFY((is_same<typename take<3, tl>::type, type_list<dummy_a, dummy_a, dummy_b>>::value)); - VERIFY((is_same<typename take<4, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b>>::value)); - VERIFY((is_same<typename take<5, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c>>::value)); - VERIFY((is_same<typename take<6, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value)); + VERIFY((std::is_same<typename take<0, tl>::type, type_list<>>::value)); + VERIFY((std::is_same<typename take<1, tl>::type, type_list<dummy_a>>::value)); + VERIFY((std::is_same<typename take<2, tl>::type, type_list<dummy_a, dummy_a>>::value)); + VERIFY((std::is_same<typename take<3, tl>::type, type_list<dummy_a, dummy_a, dummy_b>>::value)); + VERIFY((std::is_same<typename take<4, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b>>::value)); + VERIFY((std::is_same<typename take<5, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c>>::value)); + VERIFY((std::is_same<typename take<6, tl>::type, + type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value)); - VERIFY((is_same<typename take<0, il>::type, numeric_list<int>>::value)); - VERIFY((is_same<typename take<1, il>::type, numeric_list<int, 0>>::value)); - VERIFY((is_same<typename take<2, il>::type, numeric_list<int, 0, 1>>::value)); - VERIFY((is_same<typename take<3, il>::type, numeric_list<int, 0, 1, 2>>::value)); - VERIFY((is_same<typename take<4, il>::type, numeric_list<int, 0, 1, 2, 3>>::value)); - VERIFY((is_same<typename take<5, il>::type, numeric_list<int, 0, 1, 2, 3, 4>>::value)); - VERIFY((is_same<typename take<6, il>::type, numeric_list<int, 0, 1, 2, 3, 4, 5>>::value)); + VERIFY((std::is_same<typename skip<0, tl>::type, + type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value)); + VERIFY((std::is_same<typename skip<1, tl>::type, type_list<dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value)); + VERIFY((std::is_same<typename skip<2, tl>::type, type_list<dummy_b, dummy_b, dummy_c, dummy_c>>::value)); + VERIFY((std::is_same<typename skip<3, tl>::type, type_list<dummy_b, dummy_c, dummy_c>>::value)); + VERIFY((std::is_same<typename skip<4, tl>::type, type_list<dummy_c, dummy_c>>::value)); + VERIFY((std::is_same<typename skip<5, tl>::type, type_list<dummy_c>>::value)); + VERIFY((std::is_same<typename skip<6, tl>::type, type_list<>>::value)); - VERIFY((is_same<typename skip<0, tl>::type, type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value)); - VERIFY((is_same<typename skip<1, tl>::type, type_list<dummy_a, dummy_b, dummy_b, dummy_c, dummy_c>>::value)); - VERIFY((is_same<typename skip<2, tl>::type, type_list<dummy_b, dummy_b, dummy_c, dummy_c>>::value)); - VERIFY((is_same<typename skip<3, tl>::type, type_list<dummy_b, dummy_c, dummy_c>>::value)); - VERIFY((is_same<typename skip<4, tl>::type, type_list<dummy_c, dummy_c>>::value)); - VERIFY((is_same<typename skip<5, tl>::type, type_list<dummy_c>>::value)); - VERIFY((is_same<typename skip<6, tl>::type, type_list<>>::value)); - - VERIFY((is_same<typename skip<0, il>::type, numeric_list<int, 0, 1, 2, 3, 4, 5>>::value)); - VERIFY((is_same<typename skip<1, il>::type, numeric_list<int, 1, 2, 3, 4, 5>>::value)); - VERIFY((is_same<typename skip<2, il>::type, numeric_list<int, 2, 3, 4, 5>>::value)); - VERIFY((is_same<typename skip<3, il>::type, numeric_list<int, 3, 4, 5>>::value)); - VERIFY((is_same<typename skip<4, il>::type, numeric_list<int, 4, 5>>::value)); - VERIFY((is_same<typename skip<5, il>::type, numeric_list<int, 5>>::value)); - VERIFY((is_same<typename skip<6, il>::type, numeric_list<int>>::value)); - - VERIFY((is_same<typename slice<0, 3, tl>::type, typename take<3, tl>::type>::value)); - VERIFY((is_same<typename slice<0, 3, il>::type, typename take<3, il>::type>::value)); - VERIFY((is_same<typename slice<1, 3, tl>::type, type_list<dummy_a, dummy_b, dummy_b>>::value)); - VERIFY((is_same<typename slice<1, 3, il>::type, numeric_list<int, 1, 2, 3>>::value)); + VERIFY((std::is_same<typename slice<0, 3, tl>::type, typename take<3, tl>::type>::value)); + VERIFY((std::is_same<typename slice<1, 3, tl>::type, type_list<dummy_a, dummy_b, dummy_b>>::value)); } static void test_get() { typedef type_list<dummy_a, dummy_a, dummy_b, dummy_b, dummy_c, dummy_c> tl; - typedef numeric_list<int, 4, 8, 15, 16, 23, 42> il; + typedef std::integer_sequence<int, 4, 8, 15, 16, 23, 42> il; - VERIFY((is_same<typename Eigen::internal::get<0, tl>::type, dummy_a>::value)); - VERIFY((is_same<typename Eigen::internal::get<1, tl>::type, dummy_a>::value)); - VERIFY((is_same<typename Eigen::internal::get<2, tl>::type, dummy_b>::value)); - VERIFY((is_same<typename Eigen::internal::get<3, tl>::type, dummy_b>::value)); - VERIFY((is_same<typename Eigen::internal::get<4, tl>::type, dummy_c>::value)); - VERIFY((is_same<typename Eigen::internal::get<5, tl>::type, dummy_c>::value)); + VERIFY((std::is_same<typename Eigen::internal::get<0, tl>::type, dummy_a>::value)); + VERIFY((std::is_same<typename Eigen::internal::get<1, tl>::type, dummy_a>::value)); + VERIFY((std::is_same<typename Eigen::internal::get<2, tl>::type, dummy_b>::value)); + VERIFY((std::is_same<typename Eigen::internal::get<3, tl>::type, dummy_b>::value)); + VERIFY((std::is_same<typename Eigen::internal::get<4, tl>::type, dummy_c>::value)); + VERIFY((std::is_same<typename Eigen::internal::get<5, tl>::type, dummy_c>::value)); VERIFY_IS_EQUAL(((int)Eigen::internal::get<0, il>::value), 4); VERIFY_IS_EQUAL(((int)Eigen::internal::get<1, il>::value), 8); @@ -337,20 +213,20 @@ static void test_apply_op() { typedef type_list<dummy_a, dummy_b, dummy_c> tl; - VERIFY((!!is_same<typename apply_op_from_left<dummy_op, dummy_a, tl>::type, - type_list<dummy_e, dummy_c, dummy_d>>::value)); - VERIFY((!!is_same<typename apply_op_from_right<dummy_op, dummy_a, tl>::type, - type_list<dummy_e, dummy_d, dummy_b>>::value)); + VERIFY((!!std::is_same<typename apply_op_from_left<dummy_op, dummy_a, tl>::type, + type_list<dummy_e, dummy_c, dummy_d>>::value)); + VERIFY((!!std::is_same<typename apply_op_from_right<dummy_op, dummy_a, tl>::type, + type_list<dummy_e, dummy_d, dummy_b>>::value)); } static void test_contained_in_list() { typedef type_list<dummy_a, dummy_b, dummy_c> tl; - VERIFY((!!contained_in_list<is_same, dummy_a, tl>::value)); - VERIFY((!!contained_in_list<is_same, dummy_b, tl>::value)); - VERIFY((!!contained_in_list<is_same, dummy_c, tl>::value)); - VERIFY((!contained_in_list<is_same, dummy_d, tl>::value)); - VERIFY((!contained_in_list<is_same, dummy_e, tl>::value)); + VERIFY((!!contained_in_list<std::is_same, dummy_a, tl>::value)); + VERIFY((!!contained_in_list<std::is_same, dummy_b, tl>::value)); + VERIFY((!!contained_in_list<std::is_same, dummy_c, tl>::value)); + VERIFY((!contained_in_list<std::is_same, dummy_d, tl>::value)); + VERIFY((!contained_in_list<std::is_same, dummy_e, tl>::value)); VERIFY((!!contained_in_list_gf<dummy_test, dummy_a, tl>::value)); VERIFY((!!contained_in_list_gf<dummy_test, dummy_b, tl>::value)); @@ -372,127 +248,89 @@ VERIFY_IS_APPROX(arg_prod(0.5, 2, 5), 5.0); } -static void test_array_reverse_and_reduce() { +static void test_array_reductions() { array<int, 6> a{{4, 8, 15, 16, 23, 42}}; array<int, 6> b{{42, 23, 16, 15, 8, 4}}; - // there is no operator<< for std::array, so VERIFY_IS_EQUAL will - // not compile - VERIFY((array_reverse(a) == b)); - VERIFY((array_reverse(b) == a)); VERIFY_IS_EQUAL((array_sum(a)), 108); VERIFY_IS_EQUAL((array_sum(b)), 108); VERIFY_IS_EQUAL((array_prod(a)), 7418880); VERIFY_IS_EQUAL((array_prod(b)), 7418880); } -static void test_array_zip_and_apply() { - array<int, 6> a{{4, 8, 15, 16, 23, 42}}; - array<int, 6> b{{0, 1, 2, 3, 4, 5}}; - array<int, 6> c{{4, 9, 17, 19, 27, 47}}; - array<int, 6> d{{0, 8, 30, 48, 92, 210}}; - array<int, 6> e{{0, 2, 4, 6, 8, 10}}; - - VERIFY((array_zip<sum_op>(a, b) == c)); - VERIFY((array_zip<product_op>(a, b) == d)); - VERIFY((array_apply<times2_op>(b) == e)); - VERIFY_IS_EQUAL((array_apply_and_reduce<sum_op, times2_op>(a)), 216); - VERIFY_IS_EQUAL((array_apply_and_reduce<sum_op, times2_op>(b)), 30); - VERIFY_IS_EQUAL((array_zip_and_reduce<product_op, sum_op>(a, b)), 14755932); - VERIFY_IS_EQUAL((array_zip_and_reduce<sum_op, product_op>(a, b)), 388); -} - -static void test_array_misc() { - array<int, 3> a3{{1, 1, 1}}; - array<int, 6> a6{{2, 2, 2, 2, 2, 2}}; - VERIFY((repeat<3, int>(1) == a3)); - VERIFY((repeat<6, int>(2) == a6)); - - int data[5] = {0, 1, 2, 3, 4}; - VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 0>(data).c), 0); - VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 1>(data).c), 1); - VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 2>(data).c), 2); - VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 3>(data).c), 3); - VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 4>(data).c), 4); - VERIFY_IS_EQUAL((instantiate_by_c_array<dummy_inst, int, 5>(data).c), 5); -} - EIGEN_DECLARE_TEST(meta) { - VERIFY((internal::is_same<float, float>::value)); - VERIFY((!internal::is_same<float, double>::value)); - VERIFY((!internal::is_same<float, float&>::value)); - VERIFY((!internal::is_same<float, const float&>::value)); + VERIFY((std::is_same<float, float>::value)); + VERIFY((!std::is_same<float, double>::value)); + VERIFY((!std::is_same<float, float&>::value)); + VERIFY((!std::is_same<float, const float&>::value)); - VERIFY((internal::is_same<float, internal::remove_all_t<const float&>>::value)); - VERIFY((internal::is_same<float, internal::remove_all_t<const float*>>::value)); - VERIFY((internal::is_same<float, internal::remove_all_t<const float*&>>::value)); - VERIFY((internal::is_same<float, internal::remove_all_t<float**>>::value)); - VERIFY((internal::is_same<float, internal::remove_all_t<float**&>>::value)); - VERIFY((internal::is_same<float, internal::remove_all_t<float* const*&>>::value)); - VERIFY((internal::is_same<float, internal::remove_all_t<float* const>>::value)); + VERIFY((std::is_same<float, internal::remove_all_t<const float&>>::value)); + VERIFY((std::is_same<float, internal::remove_all_t<const float*>>::value)); + VERIFY((std::is_same<float, internal::remove_all_t<const float*&>>::value)); + VERIFY((std::is_same<float, internal::remove_all_t<float**>>::value)); + VERIFY((std::is_same<float, internal::remove_all_t<float**&>>::value)); + VERIFY((std::is_same<float, internal::remove_all_t<float* const*&>>::value)); + VERIFY((std::is_same<float, internal::remove_all_t<float* const>>::value)); // test add_const_on_value_type - VERIFY((internal::is_same<internal::add_const_on_value_type_t<float&>, float const&>::value)); - VERIFY((internal::is_same<internal::add_const_on_value_type_t<float*>, float const*>::value)); + VERIFY((std::is_same<internal::add_const_on_value_type_t<float&>, float const&>::value)); + VERIFY((std::is_same<internal::add_const_on_value_type_t<float*>, float const*>::value)); - VERIFY((internal::is_same<internal::add_const_on_value_type_t<float>, const float>::value)); - VERIFY((internal::is_same<internal::add_const_on_value_type_t<const float>, const float>::value)); + VERIFY((std::is_same<internal::add_const_on_value_type_t<float>, const float>::value)); + VERIFY((std::is_same<internal::add_const_on_value_type_t<const float>, const float>::value)); - VERIFY((internal::is_same<internal::add_const_on_value_type_t<const float* const>, const float* const>::value)); - VERIFY((internal::is_same<internal::add_const_on_value_type_t<float* const>, const float* const>::value)); + VERIFY((std::is_same<internal::add_const_on_value_type_t<const float* const>, const float* const>::value)); + VERIFY((std::is_same<internal::add_const_on_value_type_t<float* const>, const float* const>::value)); // is_convertible - STATIC_CHECK((internal::is_convertible<float, double>::value)); - STATIC_CHECK((internal::is_convertible<int, double>::value)); - STATIC_CHECK((internal::is_convertible<int, short>::value)); - STATIC_CHECK((internal::is_convertible<short, int>::value)); - STATIC_CHECK((internal::is_convertible<double, int>::value)); - STATIC_CHECK((internal::is_convertible<double, std::complex<double>>::value)); - STATIC_CHECK((!internal::is_convertible<std::complex<double>, double>::value)); - STATIC_CHECK((internal::is_convertible<Array33f, Matrix3f>::value)); - STATIC_CHECK((internal::is_convertible<Matrix3f&, Matrix3f>::value)); - STATIC_CHECK((internal::is_convertible<Matrix3f&, Matrix3f&>::value)); - STATIC_CHECK((internal::is_convertible<Matrix3f&, const Matrix3f&>::value)); - STATIC_CHECK((internal::is_convertible<const Matrix3f&, Matrix3f>::value)); - STATIC_CHECK((internal::is_convertible<const Matrix3f&, const Matrix3f&>::value)); - STATIC_CHECK((!internal::is_convertible<const Matrix3f&, Matrix3f&>::value)); - STATIC_CHECK((!internal::is_convertible<const Matrix3f, Matrix3f&>::value)); - STATIC_CHECK(!(internal::is_convertible<Matrix3f, Matrix3f&>::value)); + STATIC_CHECK((std::is_convertible<float, double>::value)); + STATIC_CHECK((std::is_convertible<int, double>::value)); + STATIC_CHECK((std::is_convertible<int, short>::value)); + STATIC_CHECK((std::is_convertible<short, int>::value)); + STATIC_CHECK((std::is_convertible<double, int>::value)); + STATIC_CHECK((std::is_convertible<double, std::complex<double>>::value)); + STATIC_CHECK((!std::is_convertible<std::complex<double>, double>::value)); + STATIC_CHECK((std::is_convertible<Array33f, Matrix3f>::value)); + STATIC_CHECK((std::is_convertible<Matrix3f&, Matrix3f>::value)); + STATIC_CHECK((std::is_convertible<Matrix3f&, Matrix3f&>::value)); + STATIC_CHECK((std::is_convertible<Matrix3f&, const Matrix3f&>::value)); + STATIC_CHECK((std::is_convertible<const Matrix3f&, Matrix3f>::value)); + STATIC_CHECK((std::is_convertible<const Matrix3f&, const Matrix3f&>::value)); + STATIC_CHECK((!std::is_convertible<const Matrix3f&, Matrix3f&>::value)); + STATIC_CHECK((!std::is_convertible<const Matrix3f, Matrix3f&>::value)); + STATIC_CHECK(!(std::is_convertible<Matrix3f, Matrix3f&>::value)); - STATIC_CHECK(!(internal::is_convertible<int, int&>::value)); - STATIC_CHECK((internal::is_convertible<const int, const int&>::value)); + STATIC_CHECK(!(std::is_convertible<int, int&>::value)); + STATIC_CHECK((std::is_convertible<const int, const int&>::value)); - // STATIC_CHECK((!internal::is_convertible<Matrix3f,Matrix3d>::value )); //does not even compile because the + // STATIC_CHECK((!std::is_convertible<Matrix3f,Matrix3d>::value )); //does not even compile because the // conversion is prevented by a static assertion - STATIC_CHECK((!internal::is_convertible<Array33f, int>::value)); - STATIC_CHECK((!internal::is_convertible<MatrixXf, float>::value)); + STATIC_CHECK((!std::is_convertible<Array33f, int>::value)); + STATIC_CHECK((!std::is_convertible<MatrixXf, float>::value)); { - float f = 0.0f; MatrixXf A, B; VectorXf a, b; - VERIFY((check_is_convertible(a.dot(b), f))); - VERIFY((check_is_convertible(a.transpose() * b, f))); - VERIFY((!check_is_convertible(A * B, f))); - VERIFY((check_is_convertible(A * B, A))); + VERIFY((std::is_convertible<decltype(a.dot(b)), float>::value)); + VERIFY((std::is_convertible<decltype(a.transpose() * b), float>::value)); + VERIFY((!std::is_convertible<decltype(A * B), float>::value)); + VERIFY((std::is_convertible<decltype(A * B), MatrixXf>::value)); } #if (EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC <= 990) || (EIGEN_COMP_CLANG_STRICT && EIGEN_COMP_CLANG <= 990) || \ (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC <= 1914) // See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1752, - // a fix in the c++ standard breaks our is_convertible implementation - // for abstract classes. + // a fix in the c++ standard changes std::is_convertible behavior for abstract classes. // So the following tests are expected to fail with recent compilers. - STATIC_CHECK((!internal::is_convertible<MyInterface, MyImpl>::value)); - STATIC_CHECK((!internal::is_convertible<MyImpl, MyInterface>::value)); - STATIC_CHECK((internal::is_convertible<MyImpl, const MyInterface&>::value)); + STATIC_CHECK((!std::is_convertible<MyInterface, MyImpl>::value)); + STATIC_CHECK((!std::is_convertible<MyImpl, MyInterface>::value)); + STATIC_CHECK((std::is_convertible<MyImpl, const MyInterface&>::value)); #endif { - int i = 0; - VERIFY((check_is_convertible(fix<3>(), i))); - VERIFY((!check_is_convertible(i, fix<DynamicIndex>()))); + VERIFY((std::is_convertible<decltype(fix<3>()), int>::value)); + VERIFY((!std::is_convertible<int, decltype(fix<DynamicIndex>())>::value)); } VERIFY((internal::has_ReturnType<FooReturnType>::value)); @@ -500,7 +338,6 @@ VERIFY((!internal::has_ReturnType<MatrixXf>::value)); VERIFY((!internal::has_ReturnType<int>::value)); - CALL_SUBTEST(test_gen_numeric_list()); CALL_SUBTEST(test_concat()); CALL_SUBTEST(test_slice()); CALL_SUBTEST(test_get()); @@ -509,7 +346,5 @@ CALL_SUBTEST(test_apply_op()); CALL_SUBTEST(test_contained_in_list()); CALL_SUBTEST(test_arg_reductions()); - CALL_SUBTEST(test_array_reverse_and_reduce()); - CALL_SUBTEST(test_array_zip_and_apply()); - CALL_SUBTEST(test_array_misc()); + CALL_SUBTEST(test_array_reductions()); }
diff --git a/test/mixingtypes.cpp b/test/mixingtypes.cpp index e56c2b2..7335474 100644 --- a/test/mixingtypes.cpp +++ b/test/mixingtypes.cpp
@@ -34,7 +34,7 @@ static bool g_called; #define EIGEN_SCALAR_BINARY_OP_PLUGIN \ - { g_called |= (!internal::is_same<LhsScalar, RhsScalar>::value); } + { g_called |= (!std::is_same<LhsScalar, RhsScalar>::value); } #include "main.h"
diff --git a/test/nesting_ops.cpp b/test/nesting_ops.cpp index 1e7c807..c7037db 100644 --- a/test/nesting_ops.cpp +++ b/test/nesting_ops.cpp
@@ -25,7 +25,7 @@ template <int N, typename ReferenceType, typename XprType> bool verify_eval_type(const XprType&, const ReferenceType&) { typedef typename internal::nested_eval<XprType, N>::type EvalType; - return internal::is_same<internal::remove_all_t<EvalType>, internal::remove_all_t<ReferenceType>>::value; + return std::is_same<internal::remove_all_t<EvalType>, internal::remove_all_t<ReferenceType>>::value; } template <typename MatrixType>
diff --git a/test/nullary.cpp b/test/nullary.cpp index 9131b8a..7c8f0a0 100644 --- a/test/nullary.cpp +++ b/test/nullary.cpp
@@ -35,8 +35,8 @@ typedef typename VectorType::Scalar Scalar; typedef typename VectorType::RealScalar RealScalar; - RealScalar prec = internal::is_same<RealScalar, float>::value ? NumTraits<RealScalar>::dummy_precision() * 10 - : NumTraits<RealScalar>::dummy_precision() / 10; + RealScalar prec = std::is_same<RealScalar, float>::value ? NumTraits<RealScalar>::dummy_precision() * 10 + : NumTraits<RealScalar>::dummy_precision() / 10; Index size = v.size(); if (size < 20) return; @@ -256,17 +256,17 @@ VERIFY((internal::has_nullary_operator<internal::scalar_constant_op<double> >::value)); VERIFY((!internal::has_unary_operator<internal::scalar_constant_op<double> >::value)); VERIFY((!internal::has_binary_operator<internal::scalar_constant_op<double> >::value)); - VERIFY((internal::functor_has_linear_access<internal::scalar_constant_op<double> >::ret)); + VERIFY((internal::functor_has_linear_access<internal::scalar_constant_op<double> >::value)); VERIFY((!internal::has_nullary_operator<internal::scalar_identity_op<double> >::value)); VERIFY((!internal::has_unary_operator<internal::scalar_identity_op<double> >::value)); VERIFY((internal::has_binary_operator<internal::scalar_identity_op<double> >::value)); - VERIFY((!internal::functor_has_linear_access<internal::scalar_identity_op<double> >::ret)); + VERIFY((!internal::functor_has_linear_access<internal::scalar_identity_op<double> >::value)); VERIFY((!internal::has_nullary_operator<internal::linspaced_op<float> >::value)); VERIFY((internal::has_unary_operator<internal::linspaced_op<float> >::value)); VERIFY((!internal::has_binary_operator<internal::linspaced_op<float> >::value)); - VERIFY((internal::functor_has_linear_access<internal::linspaced_op<float> >::ret)); + VERIFY((internal::functor_has_linear_access<internal::linspaced_op<float> >::value)); // Regression unit test for an MSVC bug. // Search "nullary_wrapper_workaround_msvc" in CoreEvaluators.h for the details. @@ -285,12 +285,12 @@ VERIFY((internal::has_nullary_operator<internal::scalar_constant_op<float> >::value)); VERIFY((!internal::has_unary_operator<internal::scalar_constant_op<float> >::value)); VERIFY((!internal::has_binary_operator<internal::scalar_constant_op<float> >::value)); - VERIFY((internal::functor_has_linear_access<internal::scalar_constant_op<float> >::ret)); + VERIFY((internal::functor_has_linear_access<internal::scalar_constant_op<float> >::value)); VERIFY((!internal::has_nullary_operator<internal::linspaced_op<int> >::value)); VERIFY((internal::has_unary_operator<internal::linspaced_op<int> >::value)); VERIFY((!internal::has_binary_operator<internal::linspaced_op<int> >::value)); - VERIFY((internal::functor_has_linear_access<internal::linspaced_op<int> >::ret)); + VERIFY((internal::functor_has_linear_access<internal::linspaced_op<int> >::value)); } }
diff --git a/test/numext.cpp b/test/numext.cpp index d3b1f08..5c5cebe 100644 --- a/test/numext.cpp +++ b/test/numext.cpp
@@ -226,7 +226,7 @@ template <typename T> struct check_sqrt_impl<std::complex<T>> { static void run() { - typedef typename std::complex<T> ComplexT; + typedef std::complex<T> ComplexT; for (int i = 0; i < 1000; ++i) { const ComplexT x = internal::random<ComplexT>(); @@ -294,7 +294,7 @@ template <typename T> struct check_rsqrt_impl<std::complex<T>> { static void run() { - typedef typename std::complex<T> ComplexT; + typedef std::complex<T> ComplexT; const T zero = T(0); const T one = T(1); const T inf = std::numeric_limits<T>::infinity();
diff --git a/test/packetmath.cpp b/test/packetmath.cpp index d8d8bf3..0ec9c44 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp
@@ -334,7 +334,7 @@ template <typename SrcPacket, typename TgtScalar, typename TgtPacket = typename internal::packet_traits<TgtScalar>::type, bool Vectorized = internal::packet_traits<TgtScalar>::Vectorizable, - bool HasHalf = !internal::is_same<typename internal::unpacket_traits<TgtPacket>::half, TgtPacket>::value> + bool HasHalf = !std::is_same<typename internal::unpacket_traits<TgtPacket>::half, TgtPacket>::value> struct test_cast_runner; template <typename SrcPacket, typename TgtScalar, typename TgtPacket> @@ -459,8 +459,7 @@ template <typename Scalar, typename Packet> struct packetmath_boolean_mask_ops_notcomplex_test< - Scalar, Packet, - std::enable_if_t<internal::packet_traits<Scalar>::HasCmp && !internal::is_same<Scalar, bool>::value>> { + Scalar, Packet, std::enable_if_t<internal::packet_traits<Scalar>::HasCmp && !std::is_same<Scalar, bool>::value>> { static void run() { const int PacketSize = internal::unpacket_traits<Packet>::size; const int size = 2 * PacketSize; @@ -526,8 +525,8 @@ template <typename Packet> struct eigen_optimization_barrier_test< - Packet, std::enable_if_t<!NumTraits<Packet>::IsComplex && !internal::is_same<Packet, Eigen::half>::value && - !internal::is_same<Packet, Eigen::bfloat16>::value>> { + Packet, std::enable_if_t<!NumTraits<Packet>::IsComplex && !std::is_same<Packet, Eigen::half>::value && + !std::is_same<Packet, Eigen::bfloat16>::value>> { static void run() { typedef typename internal::unpacket_traits<Packet>::type Scalar; Scalar s = internal::random<Scalar>(); @@ -731,7 +730,7 @@ for (int i = 0; i < PacketSize; ++i) ref[0] += data1[i]; VERIFY(test::isApproxAbs(ref[0], internal::predux(internal::pload<Packet>(data1)), refvalue) && "internal::predux"); - if (!internal::is_same<Packet, typename internal::unpacket_traits<Packet>::half>::value) { + if (!std::is_same<Packet, typename internal::unpacket_traits<Packet>::half>::value) { int HalfPacketSize = PacketSize > 4 ? PacketSize / 2 : PacketSize; for (int i = 0; i < HalfPacketSize; ++i) ref[i] = Scalar(0); for (int i = 0; i < PacketSize; ++i) ref[i % HalfPacketSize] += data1[i]; @@ -1106,7 +1105,7 @@ h.store(data2, internal::plog(h.load(data1))); VERIFY((numext::isnan)(data2[0])); // TODO(cantonios): Re-enable for bfloat16. - if (!internal::is_same<Scalar, bfloat16>::value) { + if (!std::is_same<Scalar, bfloat16>::value) { VERIFY_IS_APPROX(std::log(data1[1]), data2[1]); } @@ -1120,7 +1119,7 @@ data1[1] = -(std::numeric_limits<Scalar>::min)(); h.store(data2, internal::plog(h.load(data1))); // TODO(cantonios): Re-enable for bfloat16. - if (!internal::is_same<Scalar, bfloat16>::value) { + if (!std::is_same<Scalar, bfloat16>::value) { VERIFY_IS_APPROX(std::log((std::numeric_limits<Scalar>::min)()), data2[0]); } VERIFY((numext::isnan)(data2[1])); @@ -1132,7 +1131,7 @@ data1[1] = -std::numeric_limits<Scalar>::denorm_min(); h.store(data2, internal::plog(h.load(data1))); // TODO(rmlarsen): Re-enable for bfloat16. - if (!internal::is_same<Scalar, bfloat16>::value) { + if (!std::is_same<Scalar, bfloat16>::value) { VERIFY_IS_APPROX(std::log(std::numeric_limits<Scalar>::denorm_min()), data2[0]); } VERIFY((numext::isnan)(data2[1])); @@ -1165,8 +1164,7 @@ } // TODO(rmlarsen): Re-enable for half and bfloat16. - if (PacketTraits::HasCos && !internal::is_same<Scalar, half>::value && - !internal::is_same<Scalar, bfloat16>::value) { + if (PacketTraits::HasCos && !std::is_same<Scalar, half>::value && !std::is_same<Scalar, bfloat16>::value) { test::packet_helper<PacketTraits::HasCos, Packet> h; for (Scalar k = Scalar(1); k < Scalar(10000) / NumTraits<Scalar>::epsilon(); k *= Scalar(2)) { for (int k1 = 0; k1 <= 1; ++k1) {
diff --git a/test/packetmath_test_shared.h b/test/packetmath_test_shared.h index 8b2d55e..64e7619 100644 --- a/test/packetmath_test_shared.h +++ b/test/packetmath_test_shared.h
@@ -298,7 +298,7 @@ template <typename Scalar, typename PacketType = typename internal::packet_traits<Scalar>::type, bool Vectorized = internal::packet_traits<Scalar>::Vectorizable, - bool HasHalf = !internal::is_same<typename internal::unpacket_traits<PacketType>::half, PacketType>::value> + bool HasHalf = !std::is_same<typename internal::unpacket_traits<PacketType>::half, PacketType>::value> struct runner; template <typename Scalar, typename PacketType>
diff --git a/test/qr.cpp b/test/qr.cpp index c490fac..18d5253 100644 --- a/test/qr.cpp +++ b/test/qr.cpp
@@ -57,14 +57,14 @@ typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar; typedef typename MatrixType::Scalar Scalar; - STATIC_CHECK((internal::is_same<typename HouseholderQR<MatrixType>::StorageIndex, int>::value)); + STATIC_CHECK((std::is_same<typename HouseholderQR<MatrixType>::StorageIndex, int>::value)); int size = internal::random<int>(10, 50); MatrixType m1(size, size), m2(size, size), m3(size, size); m1 = MatrixType::Random(size, size); - if (internal::is_same<RealScalar, float>::value) { + if (std::is_same<RealScalar, float>::value) { // let's build a matrix more stable to inverse MatrixType a = MatrixType::Random(size, size * 4); m1 += a * a.adjoint();
diff --git a/test/qr_colpivoting.cpp b/test/qr_colpivoting.cpp index 47470eb..b4f5188 100644 --- a/test/qr_colpivoting.cpp +++ b/test/qr_colpivoting.cpp
@@ -263,7 +263,7 @@ MatrixType m1(size, size), m2(size, size), m3(size, size); m1 = MatrixType::Random(size, size); - if (internal::is_same<RealScalar, float>::value) { + if (std::is_same<RealScalar, float>::value) { // let's build a matrix more stable to inverse MatrixType a = MatrixType::Random(size, size * 2); m1 += a * a.adjoint();
diff --git a/test/qr_fullpivoting.cpp b/test/qr_fullpivoting.cpp index c2fd6da..f2595da 100644 --- a/test/qr_fullpivoting.cpp +++ b/test/qr_fullpivoting.cpp
@@ -82,7 +82,7 @@ MatrixType m1(size, size), m2(size, size), m3(size, size); m1 = MatrixType::Random(size, size); - if (internal::is_same<RealScalar, float>::value) { + if (std::is_same<RealScalar, float>::value) { // let's build a matrix more stable to inverse MatrixType a = MatrixType::Random(size, size * 2); m1 += a * a.adjoint();
diff --git a/test/rand.cpp b/test/rand.cpp index 793460d..99df7b9 100644 --- a/test/rand.cpp +++ b/test/rand.cpp
@@ -88,7 +88,7 @@ using type = std::conditional_t<(sizeof(T) < sizeof(int)), unsigned int, std::make_unsigned_t<T>>; }; template <typename T> -struct get_range_type<SafeScalar<T>> : internal::make_unsigned<T> {}; +struct get_range_type<SafeScalar<T>> : std::make_unsigned<T> {}; template <typename Scalar> class HistogramHelper<Scalar, std::enable_if_t<Eigen::NumTraits<Scalar>::IsInteger>> {
diff --git a/test/reshape.cpp b/test/reshape.cpp index 9aeffeb..4b18736 100644 --- a/test/reshape.cpp +++ b/test/reshape.cpp
@@ -15,7 +15,7 @@ using Eigen::placeholders::last; template <typename T1, typename T2> -std::enable_if_t<internal::is_same<T1, T2>::value, bool> is_same_eq(const T1& a, const T2& b) { +std::enable_if_t<std::is_same<T1, T2>::value, bool> is_same_eq(const T1& a, const T2& b) { return (a.array() == b.array()).all(); }
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp index 2a8e710..94f5717 100644 --- a/test/sparse_basic.cpp +++ b/test/sparse_basic.cpp
@@ -55,7 +55,7 @@ // test coeff and coeffRef for (std::size_t i = 0; i < zeroCoords.size(); ++i) { VERIFY_IS_MUCH_SMALLER_THAN(m.coeff(zeroCoords[i].x(), zeroCoords[i].y()), eps); - if (internal::is_same<SparseMatrixType, SparseMatrix<Scalar, Flags>>::value) + if (std::is_same<SparseMatrixType, SparseMatrix<Scalar, Flags>>::value) VERIFY_RAISES_ASSERT(m.coeffRef(zeroCoords[i].x(), zeroCoords[i].y()) = 5); } VERIFY_IS_APPROX(m, refMat);
diff --git a/test/sparse_permutations.cpp b/test/sparse_permutations.cpp index 84b7d1c..8481c18 100644 --- a/test/sparse_permutations.cpp +++ b/test/sparse_permutations.cpp
@@ -234,12 +234,12 @@ CALL_SUBTEST_2((sparse_permutations_all<std::complex<double> >(s))); } - VERIFY((internal::is_same< + VERIFY((std::is_same< internal::permutation_matrix_product<SparseMatrix<double>, OnTheRight, false, SparseShape>::ReturnType, internal::nested_eval<Product<SparseMatrix<double>, PermutationMatrix<Dynamic, Dynamic>, AliasFreeProduct>, 1>::type>::value)); - VERIFY((internal::is_same< + VERIFY((std::is_same< internal::permutation_matrix_product<SparseMatrix<double>, OnTheLeft, false, SparseShape>::ReturnType, internal::nested_eval<Product<PermutationMatrix<Dynamic, Dynamic>, SparseMatrix<double>, AliasFreeProduct>, 1>::type>::value));
diff --git a/test/sparse_solver.h b/test/sparse_solver.h index 1dec71c..c4819be 100644 --- a/test/sparse_solver.h +++ b/test/sparse_solver.h
@@ -371,7 +371,7 @@ template <typename Scalar> inline std::string get_matrixfolder() { std::string mat_folder = TEST_REAL_CASES; - if (internal::is_same<Scalar, std::complex<float>>::value || internal::is_same<Scalar, std::complex<double>>::value) + if (std::is_same<Scalar, std::complex<float>>::value || std::is_same<Scalar, std::complex<double>>::value) mat_folder = mat_folder + static_cast<std::string>("/complex/"); else mat_folder = mat_folder + static_cast<std::string>("/real/"); @@ -440,7 +440,7 @@ // First, get the folder #ifdef TEST_REAL_CASES // Test real problems with double precision only - if (internal::is_same<typename NumTraits<Scalar>::Real, double>::value) { + if (std::is_same<typename NumTraits<Scalar>::Real, double>::value) { std::string mat_folder = get_matrixfolder<Scalar>(); MatrixMarketIterator<Scalar> it(mat_folder); for (; it; ++it) { @@ -662,7 +662,7 @@ // First, get the folder #ifdef TEST_REAL_CASES // Test real problems with double precision only - if (internal::is_same<typename NumTraits<Scalar>::Real, double>::value) { + if (std::is_same<typename NumTraits<Scalar>::Real, double>::value) { std::string mat_folder = get_matrixfolder<Scalar>(); MatrixMarketIterator<Scalar> it(mat_folder); for (; it; ++it) {
diff --git a/test/stl_iterators.cpp b/test/stl_iterators.cpp index e7e4265..46fef46 100644 --- a/test/stl_iterators.cpp +++ b/test/stl_iterators.cpp
@@ -535,11 +535,10 @@ { using VecOp = VectorwiseOp<ArrayXXi, 0>; - STATIC_CHECK((internal::is_same<VecOp::const_iterator, decltype(std::declval<const VecOp&>().cbegin())>::value)); - STATIC_CHECK((internal::is_same<VecOp::const_iterator, decltype(std::declval<const VecOp&>().cend())>::value)); - STATIC_CHECK( - (internal::is_same<VecOp::const_iterator, decltype(std::cbegin(std::declval<const VecOp&>()))>::value)); - STATIC_CHECK((internal::is_same<VecOp::const_iterator, decltype(std::cend(std::declval<const VecOp&>()))>::value)); + STATIC_CHECK((std::is_same<VecOp::const_iterator, decltype(std::declval<const VecOp&>().cbegin())>::value)); + STATIC_CHECK((std::is_same<VecOp::const_iterator, decltype(std::declval<const VecOp&>().cend())>::value)); + STATIC_CHECK((std::is_same<VecOp::const_iterator, decltype(std::cbegin(std::declval<const VecOp&>()))>::value)); + STATIC_CHECK((std::is_same<VecOp::const_iterator, decltype(std::cend(std::declval<const VecOp&>()))>::value)); } }
diff --git a/test/svd_common.h b/test/svd_common.h index 978957f..82aa659 100644 --- a/test/svd_common.h +++ b/test/svd_common.h
@@ -109,9 +109,9 @@ RhsType rhs = RhsType::Random(rows, internal::random<Index>(1, cols)); SvdType svd(m); - if (internal::is_same<RealScalar, double>::value) + if (std::is_same<RealScalar, double>::value) svd.setThreshold(RealScalar(1e-8)); - else if (internal::is_same<RealScalar, float>::value) + else if (std::is_same<RealScalar, float>::value) svd.setThreshold(RealScalar(2e-4)); SolutionType x = svd.solve(rhs); @@ -122,15 +122,15 @@ // ^^^ If the residual is very small, then we have an exact solution, so we are already good. // evaluate normal equation which works also for least-squares solutions - if (internal::is_same<RealScalar, double>::value || svd.rank() == m.diagonal().size()) { + if (std::is_same<RealScalar, double>::value || svd.rank() == m.diagonal().size()) { using std::sqrt; // This test is not stable with single precision. // This is likely because squaring m significantly affects the precision. - if (internal::is_same<RealScalar, float>::value) ++g_test_level; + if (std::is_same<RealScalar, float>::value) ++g_test_level; VERIFY_IS_APPROX(m.adjoint() * (m * x), m.adjoint() * rhs); - if (internal::is_same<RealScalar, float>::value) --g_test_level; + if (std::is_same<RealScalar, float>::value) --g_test_level; } // Check that there is no significantly better solution in the neighborhood of x @@ -141,16 +141,16 @@ y.row(k) = (RealScalar(1) + 2 * NumTraits<RealScalar>::epsilon()) * x.row(k); RealScalar residual_y = (m * y - rhs).norm(); VERIFY(test_isMuchSmallerThan(abs(residual_y - residual), rhs_norm) || residual < residual_y); - if (internal::is_same<RealScalar, float>::value) ++g_test_level; + if (std::is_same<RealScalar, float>::value) ++g_test_level; VERIFY(test_isApprox(residual_y, residual) || residual < residual_y); - if (internal::is_same<RealScalar, float>::value) --g_test_level; + if (std::is_same<RealScalar, float>::value) --g_test_level; y.row(k) = (RealScalar(1) - 2 * NumTraits<RealScalar>::epsilon()) * x.row(k); residual_y = (m * y - rhs).norm(); VERIFY(test_isMuchSmallerThan(abs(residual_y - residual), rhs_norm) || residual < residual_y); - if (internal::is_same<RealScalar, float>::value) ++g_test_level; + if (std::is_same<RealScalar, float>::value) ++g_test_level; VERIFY(test_isApprox(residual_y, residual) || residual < residual_y); - if (internal::is_same<RealScalar, float>::value) --g_test_level; + if (std::is_same<RealScalar, float>::value) --g_test_level; } } }
diff --git a/test/swap.cpp b/test/swap.cpp index 66f9b1c..04ae2a0 100644 --- a/test/swap.cpp +++ b/test/swap.cpp
@@ -40,7 +40,7 @@ typedef typename other_matrix_type<MatrixType>::type OtherMatrixType; typedef typename MatrixType::Scalar Scalar; - eigen_assert((!internal::is_same<MatrixType, OtherMatrixType>::value)); + eigen_assert((!std::is_same<MatrixType, OtherMatrixType>::value)); Index rows = m.rows(); Index cols = m.cols();
diff --git a/test/type_alias.cpp b/test/type_alias.cpp index c3ec56c..647e4b0 100644 --- a/test/type_alias.cpp +++ b/test/type_alias.cpp
@@ -14,29 +14,29 @@ using namespace internal; // To warm up, some basic checks: - STATIC_CHECK((is_same<MatrixXd, Matrix<double, Dynamic, Dynamic> >::value)); - STATIC_CHECK((is_same<Matrix2f, Matrix<float, 2, 2> >::value)); - STATIC_CHECK((is_same<Array33i, Array<int, 3, 3> >::value)); + STATIC_CHECK((std::is_same<MatrixXd, Matrix<double, Dynamic, Dynamic> >::value)); + STATIC_CHECK((std::is_same<Matrix2f, Matrix<float, 2, 2> >::value)); + STATIC_CHECK((std::is_same<Array33i, Array<int, 3, 3> >::value)); - STATIC_CHECK((is_same<MatrixX<double>, MatrixXd>::value)); - STATIC_CHECK((is_same<MatrixX<int>, MatrixXi>::value)); - STATIC_CHECK((is_same<Matrix2<int>, Matrix2i>::value)); - STATIC_CHECK((is_same<Matrix2X<float>, Matrix2Xf>::value)); - STATIC_CHECK((is_same<MatrixX4<double>, MatrixX4d>::value)); - STATIC_CHECK((is_same<VectorX<int>, VectorXi>::value)); - STATIC_CHECK((is_same<Vector2<float>, Vector2f>::value)); - STATIC_CHECK((is_same<RowVectorX<int>, RowVectorXi>::value)); - STATIC_CHECK((is_same<RowVector2<float>, RowVector2f>::value)); + STATIC_CHECK((std::is_same<MatrixX<double>, MatrixXd>::value)); + STATIC_CHECK((std::is_same<MatrixX<int>, MatrixXi>::value)); + STATIC_CHECK((std::is_same<Matrix2<int>, Matrix2i>::value)); + STATIC_CHECK((std::is_same<Matrix2X<float>, Matrix2Xf>::value)); + STATIC_CHECK((std::is_same<MatrixX4<double>, MatrixX4d>::value)); + STATIC_CHECK((std::is_same<VectorX<int>, VectorXi>::value)); + STATIC_CHECK((std::is_same<Vector2<float>, Vector2f>::value)); + STATIC_CHECK((std::is_same<RowVectorX<int>, RowVectorXi>::value)); + STATIC_CHECK((std::is_same<RowVector2<float>, RowVector2f>::value)); - STATIC_CHECK((is_same<ArrayXX<float>, ArrayXXf>::value)); - STATIC_CHECK((is_same<Array33<int>, Array33i>::value)); - STATIC_CHECK((is_same<Array2X<float>, Array2Xf>::value)); - STATIC_CHECK((is_same<ArrayX4<double>, ArrayX4d>::value)); - STATIC_CHECK((is_same<ArrayX<double>, ArrayXd>::value)); - STATIC_CHECK((is_same<Array4<double>, Array4d>::value)); + STATIC_CHECK((std::is_same<ArrayXX<float>, ArrayXXf>::value)); + STATIC_CHECK((std::is_same<Array33<int>, Array33i>::value)); + STATIC_CHECK((std::is_same<Array2X<float>, Array2Xf>::value)); + STATIC_CHECK((std::is_same<ArrayX4<double>, ArrayX4d>::value)); + STATIC_CHECK((std::is_same<ArrayX<double>, ArrayXd>::value)); + STATIC_CHECK((std::is_same<Array4<double>, Array4d>::value)); - STATIC_CHECK((is_same<Vector<float, 3>, Vector3f>::value)); - STATIC_CHECK((is_same<Vector<int, Dynamic>, VectorXi>::value)); - STATIC_CHECK((is_same<RowVector<float, 3>, RowVector3f>::value)); - STATIC_CHECK((is_same<RowVector<int, Dynamic>, RowVectorXi>::value)); + STATIC_CHECK((std::is_same<Vector<float, 3>, Vector3f>::value)); + STATIC_CHECK((std::is_same<Vector<int, Dynamic>, VectorXi>::value)); + STATIC_CHECK((std::is_same<RowVector<float, 3>, RowVector3f>::value)); + STATIC_CHECK((std::is_same<RowVector<int, Dynamic>, RowVectorXi>::value)); }
diff --git a/test/vectorization_logic.cpp b/test/vectorization_logic.cpp index 1e008e3..e0358bf 100644 --- a/test/vectorization_logic.cpp +++ b/test/vectorization_logic.cpp
@@ -400,9 +400,10 @@ static void run() {} }; -template <typename Scalar, bool Enable = !internal::is_same< - typename internal::unpacket_traits<typename internal::packet_traits<Scalar>::type>::half, - typename internal::packet_traits<Scalar>::type>::value> +template <typename Scalar, + bool Enable = + !std::is_same<typename internal::unpacket_traits<typename internal::packet_traits<Scalar>::type>::half, + typename internal::packet_traits<Scalar>::type>::value> struct vectorization_logic_half { using RealScalar = typename NumTraits<Scalar>::Real; typedef internal::packet_traits<Scalar> PacketTraits;
diff --git a/unsupported/Eigen/FFT b/unsupported/Eigen/FFT index 460fdbe..a50dd27 100644 --- a/unsupported/Eigen/FFT +++ b/unsupported/Eigen/FFT
@@ -237,7 +237,7 @@ EIGEN_STATIC_ASSERT_VECTOR_ONLY(ComplexDerived) EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(ComplexDerived, InputDerived) // size at compile-time EIGEN_STATIC_ASSERT( - (internal::is_same<dst_type, Complex>::value), + (std::is_same<dst_type, Complex>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) EIGEN_STATIC_ASSERT(int(InputDerived::Flags) & int(ComplexDerived::Flags) & DirectAccessBit, THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES) @@ -308,7 +308,7 @@ EIGEN_STATIC_ASSERT_VECTOR_ONLY(ComplexDerived) EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(ComplexDerived, OutputDerived) // size at compile-time EIGEN_STATIC_ASSERT( - (internal::is_same<src_type, Complex>::value), + (std::is_same<src_type, Complex>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) EIGEN_STATIC_ASSERT(int(OutputDerived::Flags) & int(ComplexDerived::Flags) & DirectAccessBit, THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES)
diff --git a/unsupported/Eigen/TensorSymmetry b/unsupported/Eigen/TensorSymmetry index 491a0e1..da1c007 100644 --- a/unsupported/Eigen/TensorSymmetry +++ b/unsupported/Eigen/TensorSymmetry
@@ -15,8 +15,6 @@ #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" -#include "src/TensorUtil/CXX11Meta.h" - /** \defgroup TensorSymmetry_Module Tensor Symmetry Module * * This module provides a classes that allow for the definition of
diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index 52afd70..07cfd70 100644 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
@@ -95,13 +95,13 @@ template <typename DerivativeType> class AutoDiffScalar : public internal::auto_diff_special_op< - DerivativeType, !internal::is_same<typename internal::traits<internal::remove_all_t<DerivativeType>>::Scalar, - typename NumTraits<typename internal::traits< - internal::remove_all_t<DerivativeType>>::Scalar>::Real>::value> { + DerivativeType, !std::is_same<typename internal::traits<internal::remove_all_t<DerivativeType>>::Scalar, + typename NumTraits<typename internal::traits< + internal::remove_all_t<DerivativeType>>::Scalar>::Real>::value> { public: typedef internal::auto_diff_special_op< DerivativeType, - !internal::is_same< + !std::is_same< typename internal::traits<internal::remove_all_t<DerivativeType>>::Scalar, typename NumTraits<typename internal::traits<internal::remove_all_t<DerivativeType>>::Scalar>::Real>::value> Base; @@ -136,8 +136,8 @@ #ifndef EIGEN_PARSED_BY_DOXYGEN , std::enable_if_t< - internal::is_same<Scalar, typename internal::traits<internal::remove_all_t<OtherDerType>>::Scalar>::value && - internal::is_convertible<OtherDerType, DerType>::value, + std::is_same<Scalar, typename internal::traits<internal::remove_all_t<OtherDerType>>::Scalar>::value && + std::is_convertible<OtherDerType, DerType>::value, void*> = 0 #endif ) @@ -336,7 +336,7 @@ template <typename DerivativeType> struct auto_diff_special_op<DerivativeType, true> // : auto_diff_scalar_op<DerivativeType, typename NumTraits<Scalar>::Real, -// is_same<Scalar,typename NumTraits<Scalar>::Real>::value> +// std::is_same<Scalar,typename NumTraits<Scalar>::Real>::value> { typedef remove_all_t<DerivativeType> DerType; typedef typename traits<DerType>::Scalar Scalar;
diff --git a/unsupported/Eigen/src/AutoDiff/CoherentPadOp.h b/unsupported/Eigen/src/AutoDiff/CoherentPadOp.h index 4875c15..f8d7312 100644 --- a/unsupported/Eigen/src/AutoDiff/CoherentPadOp.h +++ b/unsupported/Eigen/src/AutoDiff/CoherentPadOp.h
@@ -25,7 +25,7 @@ struct traits<CoherentPadOp<XprType, SizeAtCompileTime_>> : public traits<XprType> { typedef internal::remove_all_t<XprType> PlainXprType; typedef typename internal::ref_selector<XprType>::type XprNested; - typedef typename std::remove_reference_t<XprNested> XprNested_; + typedef std::remove_reference_t<XprNested> XprNested_; enum : int { IsRowMajor = traits<PlainXprType>::Flags & RowMajorBit, SizeAtCompileTime = SizeAtCompileTime_, @@ -77,7 +77,7 @@ struct unary_evaluator<CoherentPadOp<ArgType, SizeAtCompileTime>> : evaluator_base<CoherentPadOp<ArgType, SizeAtCompileTime>> { typedef CoherentPadOp<ArgType, SizeAtCompileTime> XprType; - typedef typename internal::remove_all_t<typename XprType::CoeffReturnType> CoeffReturnType; + typedef internal::remove_all_t<typename XprType::CoeffReturnType> CoeffReturnType; typedef typename internal::nested_eval<ArgType, 1>::type ArgTypeNested; typedef internal::remove_all_t<ArgTypeNested> ArgTypeNestedCleaned;
diff --git a/unsupported/Eigen/src/EulerAngles/EulerAngles.h b/unsupported/Eigen/src/EulerAngles/EulerAngles.h index c122397..c5944d6 100644 --- a/unsupported/Eigen/src/EulerAngles/EulerAngles.h +++ b/unsupported/Eigen/src/EulerAngles/EulerAngles.h
@@ -239,7 +239,7 @@ template <class Derived> EulerAngles& operator=(const MatrixBase<Derived>& other) { EIGEN_STATIC_ASSERT( - (internal::is_same<Scalar, typename Derived::Scalar>::value), + (std::is_same<Scalar, typename Derived::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) internal::eulerangles_assign_impl<System, Derived>::run(*this, other.derived());
diff --git a/unsupported/Eigen/src/EulerAngles/EulerSystem.h b/unsupported/Eigen/src/EulerAngles/EulerSystem.h index 52ee4b9..3611e9f 100644 --- a/unsupported/Eigen/src/EulerAngles/EulerSystem.h +++ b/unsupported/Eigen/src/EulerAngles/EulerSystem.h
@@ -22,19 +22,13 @@ namespace internal { // TODO: Add this trait to the Eigen internal API? template <int Num, bool IsPositive = (Num > 0)> -struct Abs { - enum { value = Num }; -}; +struct Abs : std::integral_constant<int, Num> {}; template <int Num> -struct Abs<Num, false> { - enum { value = -Num }; -}; +struct Abs<Num, false> : std::integral_constant<int, -Num> {}; template <int Axis> -struct IsValidAxis { - enum { value = Axis != 0 && Abs<Axis>::value <= 3 }; -}; +struct IsValidAxis : std::integral_constant<bool, Axis != 0 && Abs<Axis>::value <= 3> {}; template <typename System, typename Other, int OtherRows = Other::RowsAtCompileTime, int OtherCols = Other::ColsAtCompileTime>
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h index 0697119..28ecf44 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
@@ -366,18 +366,14 @@ }; template <typename T> -struct is_exp_known_type : false_type {}; -template <> -struct is_exp_known_type<float> : true_type {}; -template <> -struct is_exp_known_type<double> : true_type {}; +using is_exp_known_type = std::integral_constant<bool, std::is_same<T, float>::value || std::is_same<T, double>::value #if LDBL_MANT_DIG <= 113 -template <> -struct is_exp_known_type<long double> : true_type {}; + || std::is_same<T, long double>::value #endif + >; template <typename ArgType, typename ResultType> -void matrix_exp_compute(const ArgType& arg, ResultType& result, true_type) // natively supported scalar type +void matrix_exp_compute(const ArgType& arg, ResultType& result, std::true_type) // natively supported scalar type { typedef typename ArgType::PlainObject MatrixType; MatrixType U, V; @@ -395,7 +391,7 @@ * \param result variable in which result will be stored */ template <typename ArgType, typename ResultType> -void matrix_exp_compute(const ArgType& arg, ResultType& result, false_type) // default +void matrix_exp_compute(const ArgType& arg, ResultType& result, std::false_type) // default { typedef typename ArgType::PlainObject MatrixType; typedef make_complex_t<typename traits<MatrixType>::Scalar> ComplexScalar;
diff --git a/unsupported/Eigen/src/Polynomials/Companion.h b/unsupported/Eigen/src/Polynomials/Companion.h index b417a48..ace2de3 100644 --- a/unsupported/Eigen/src/Polynomials/Companion.h +++ b/unsupported/Eigen/src/Polynomials/Companion.h
@@ -25,9 +25,7 @@ #ifndef EIGEN_PARSED_BY_DOXYGEN template <int Size> -struct decrement_if_fixed_size { - enum { ret = (Size == Dynamic) ? Dynamic : Size - 1 }; -}; +struct decrement_if_fixed_size : std::integral_constant<int, (Size == Dynamic) ? Dynamic : Size - 1> {}; #endif @@ -36,7 +34,7 @@ public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar_, Deg_ == Dynamic ? Dynamic : Deg_) - enum { Deg = Deg_, Deg_1 = decrement_if_fixed_size<Deg>::ret }; + enum { Deg = Deg_, Deg_1 = decrement_if_fixed_size<Deg>::value }; typedef Scalar_ Scalar; typedef typename NumTraits<Scalar>::Real RealScalar;
diff --git a/unsupported/Eigen/src/SparseExtra/MarketIO.h b/unsupported/Eigen/src/SparseExtra/MarketIO.h index d0a33ee..157fbcb 100644 --- a/unsupported/Eigen/src/SparseExtra/MarketIO.h +++ b/unsupported/Eigen/src/SparseExtra/MarketIO.h
@@ -72,8 +72,7 @@ template <typename Scalar> inline void putMarketHeader(std::string& header, int sym) { header = "%%MatrixMarket matrix coordinate "; - if (internal::is_same<Scalar, std::complex<float> >::value || - internal::is_same<Scalar, std::complex<double> >::value) { + if (std::is_same<Scalar, std::complex<float> >::value || std::is_same<Scalar, std::complex<double> >::value) { header += " complex"; if (sym == Symmetric) header += " symmetric"; @@ -339,7 +338,7 @@ out.flags(std::ios_base::scientific); out.precision(std::numeric_limits<RealScalar>::digits10 + 2); - if (internal::is_same<Scalar, std::complex<float> >::value || internal::is_same<Scalar, std::complex<double> >::value) + if (std::is_same<Scalar, std::complex<float> >::value || std::is_same<Scalar, std::complex<double> >::value) out << "%%MatrixMarket matrix array complex general\n"; else out << "%%MatrixMarket matrix array real general\n";
diff --git a/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h b/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h index 1894888..eb1d632 100644 --- a/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h +++ b/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h
@@ -179,12 +179,11 @@ if (!getMarketHeader(curfile, m_sym, iscomplex, isvector)) continue; if (isvector) continue; if (!iscomplex) { - if (internal::is_same<Scalar, std::complex<float> >::value || - internal::is_same<Scalar, std::complex<double> >::value) + if (std::is_same<Scalar, std::complex<float> >::value || std::is_same<Scalar, std::complex<double> >::value) continue; } if (iscomplex) { - if (internal::is_same<Scalar, float>::value || internal::is_same<Scalar, double>::value) continue; + if (std::is_same<Scalar, float>::value || std::is_same<Scalar, double>::value) continue; } // Get the matrix name
diff --git a/unsupported/Eigen/src/SparseExtra/SparseInverse.h b/unsupported/Eigen/src/SparseExtra/SparseInverse.h index dd0a788..f0e1389 100644 --- a/unsupported/Eigen/src/SparseExtra/SparseInverse.h +++ b/unsupported/Eigen/src/SparseExtra/SparseInverse.h
@@ -84,7 +84,7 @@ EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived, OtherDerived) - static_assert(internal::is_same<Scalar, typename OtherDerived::Scalar>::value, "mismatched types"); + static_assert(std::is_same<Scalar, typename OtherDerived::Scalar>::value, "mismatched types"); internal::evaluator<Derived> thisEval(A.derived()); typename Derived::ReverseInnerIterator i(thisEval, 0);
diff --git a/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h b/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h index fb2e700..e0f25d7 100644 --- a/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h +++ b/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h
@@ -51,7 +51,7 @@ template <typename T, typename ScalarType = typename unpacket_traits<T>::type> struct generic_i0e { - EIGEN_STATIC_ASSERT((internal::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -206,7 +206,7 @@ template <typename T, typename ScalarType = typename unpacket_traits<T>::type> struct generic_i1e { - EIGEN_STATIC_ASSERT((internal::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -362,7 +362,7 @@ template <typename T, typename ScalarType = typename unpacket_traits<T>::type> struct generic_k0e { - EIGEN_STATIC_ASSERT((internal::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -487,7 +487,7 @@ template <typename T, typename ScalarType = typename unpacket_traits<T>::type> struct generic_k0 { - EIGEN_STATIC_ASSERT((internal::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -621,7 +621,7 @@ template <typename T, typename ScalarType = typename unpacket_traits<T>::type> struct generic_k1e { - EIGEN_STATIC_ASSERT((internal::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -751,7 +751,7 @@ template <typename T, typename ScalarType = typename unpacket_traits<T>::type> struct generic_k1 { - EIGEN_STATIC_ASSERT((internal::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -888,7 +888,7 @@ template <typename T, typename ScalarType = typename unpacket_traits<T>::type> struct generic_j0 { - EIGEN_STATIC_ASSERT((internal::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -1062,7 +1062,7 @@ template <typename T, typename ScalarType = typename unpacket_traits<T>::type> struct generic_y0 { - EIGEN_STATIC_ASSERT((internal::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -1236,7 +1236,7 @@ template <typename T, typename ScalarType = typename unpacket_traits<T>::type> struct generic_j1 { - EIGEN_STATIC_ASSERT((internal::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -1401,7 +1401,7 @@ template <typename T, typename ScalarType = typename unpacket_traits<T>::type> struct generic_y1 { - EIGEN_STATIC_ASSERT((internal::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<T, T>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } };
diff --git a/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h b/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h index 33cd5f4..a920259 100644 --- a/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h +++ b/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h
@@ -46,7 +46,7 @@ template <typename Scalar> struct lgamma_impl { - EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Scalar) { return Scalar(0); } }; @@ -124,7 +124,7 @@ */ template <typename Scalar> struct digamma_impl_maybe_poly { - EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Scalar) { return Scalar(0); } }; @@ -741,7 +741,7 @@ template <typename Scalar> struct ndtri_impl { - EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Scalar) { return Scalar(0); } }; @@ -830,9 +830,9 @@ return 2000; } - if (internal::is_same<Scalar, float>::value) { + if (std::is_same<Scalar, float>::value) { return 200; - } else if (internal::is_same<Scalar, double>::value) { + } else if (std::is_same<Scalar, double>::value) { return 500; } else { return 2000; @@ -1030,7 +1030,7 @@ template <typename Scalar> struct igammac_impl { - EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static Scalar run(Scalar a, Scalar x) { return Scalar(0); } }; @@ -1127,7 +1127,7 @@ template <typename Scalar, IgammaComputationMode mode> struct igamma_generic_impl { - EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(Scalar a, Scalar x) { return Scalar(0); } }; @@ -1334,7 +1334,7 @@ template <typename Scalar> struct zeta_impl_series { - EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Scalar) { return Scalar(0); } }; @@ -1538,7 +1538,7 @@ template <typename Scalar> struct polygamma_impl { - EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(Scalar n, Scalar x) { return Scalar(0); } }; @@ -1583,7 +1583,7 @@ template <typename Scalar> struct betainc_impl { - EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(Scalar a, Scalar b, Scalar x) { return Scalar(0); } }; @@ -1592,7 +1592,7 @@ template <typename Scalar> struct betainc_impl { - EIGEN_STATIC_ASSERT((internal::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) + EIGEN_STATIC_ASSERT((std::is_same<Scalar, Scalar>::value == false), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(Scalar, Scalar, Scalar) { /* betaincf.c @@ -1672,7 +1672,7 @@ */ template <typename Scalar> struct incbeta_cfe { - EIGEN_STATIC_ASSERT((internal::is_same<Scalar, float>::value || internal::is_same<Scalar, double>::value), + EIGEN_STATIC_ASSERT((std::is_same<Scalar, float>::value || std::is_same<Scalar, double>::value), THIS_TYPE_IS_NOT_SUPPORTED) EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(Scalar a, Scalar b, Scalar x, bool small_branch) { @@ -1689,9 +1689,9 @@ Scalar ans; int n; - const int num_iters = (internal::is_same<Scalar, float>::value) ? 100 : 300; - const Scalar thresh = (internal::is_same<Scalar, float>::value) ? machep : Scalar(3) * machep; - Scalar r = (internal::is_same<Scalar, float>::value) ? zero : one; + const int num_iters = (std::is_same<Scalar, float>::value) ? 100 : 300; + const Scalar thresh = (std::is_same<Scalar, float>::value) ? machep : Scalar(3) * machep; + Scalar r = (std::is_same<Scalar, float>::value) ? zero : one; if (small_branch) { k1 = a;
diff --git a/unsupported/Eigen/src/Tensor/Tensor.h b/unsupported/Eigen/src/Tensor/Tensor.h index 8a859ef..28e489a 100644 --- a/unsupported/Eigen/src/Tensor/Tensor.h +++ b/unsupported/Eigen/src/Tensor/Tensor.h
@@ -89,7 +89,7 @@ template <typename CustomIndices> struct isOfNormalIndex { - static constexpr bool is_array = internal::is_base_of<array<Index, NumIndices>, CustomIndices>::value; + static constexpr bool is_array = std::is_base_of<array<Index, NumIndices>, CustomIndices>::value; static constexpr bool is_int = NumTraits<CustomIndices>::IsInteger; static constexpr bool value = is_array | is_int; }; @@ -356,17 +356,10 @@ protected: bool checkIndexRange(const array<Index, NumIndices>& indices) const { - using internal::array_apply_and_reduce; - using internal::array_zip_and_reduce; - using internal::greater_equal_zero_op; - using internal::lesser_op; - using internal::logical_and_op; - - return - // check whether the indices are all >= 0 - array_apply_and_reduce<logical_and_op, greater_equal_zero_op>(indices) && - // check whether the indices fit in the dimensions - array_zip_and_reduce<logical_and_op, lesser_op>(indices, m_storage.dimensions()); + for (std::size_t i = 0; i < NumIndices; ++i) { + if (indices[i] < 0 || indices[i] >= m_storage.dimensions()[i]) return false; + } + return true; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index linearizedIndex(const array<Index, NumIndices>& indices) const {
diff --git a/unsupported/Eigen/src/Tensor/TensorBase.h b/unsupported/Eigen/src/Tensor/TensorBase.h index be43a18..4bf02bb 100644 --- a/unsupported/Eigen/src/Tensor/TensorBase.h +++ b/unsupported/Eigen/src/Tensor/TensorBase.h
@@ -369,7 +369,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<internal::bind2nd_op<internal::scalar_difference_op<Scalar,Scalar> >, const Derived> operator- (Scalar rhs) const { - EIGEN_STATIC_ASSERT((NumTraits<Scalar>::IsSigned || internal::is_same<Scalar, const std::complex<float> >::value), YOU_MADE_A_PROGRAMMING_MISTAKE); + EIGEN_STATIC_ASSERT((NumTraits<Scalar>::IsSigned || std::is_same<Scalar, const std::complex<float> >::value), YOU_MADE_A_PROGRAMMING_MISTAKE); return unaryExpr(internal::bind2nd_op<internal::scalar_difference_op<Scalar,Scalar> >(rhs)); } @@ -429,11 +429,11 @@ template<typename NewType> EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE const std::conditional_t<internal::is_same<NewType, CoeffReturnType>::value, + EIGEN_STRONG_INLINE const std::conditional_t<std::is_same<NewType, CoeffReturnType>::value, Derived, TensorConversionOp<NewType, const Derived> > cast() const { - return choose(Cond<internal::is_same<NewType, CoeffReturnType>::value>(), derived(), TensorConversionOp<NewType, const Derived>(derived())); + return choose(Cond<std::is_same<NewType, CoeffReturnType>::value>(), derived(), TensorConversionOp<NewType, const Derived>(derived())); } EIGEN_DEVICE_FUNC @@ -752,26 +752,26 @@ } template <typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE - const TensorReductionOp<internal::AndReducer, const Dims, const std::conditional_t<internal::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > > + const TensorReductionOp<internal::AndReducer, const Dims, const std::conditional_t<std::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > > all(const Dims& dims) const { return cast<bool>().reduce(dims, internal::AndReducer()); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE - const TensorReductionOp<internal::AndReducer, const DimensionList<Index, NumDimensions>, const std::conditional_t<internal::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > > + const TensorReductionOp<internal::AndReducer, const DimensionList<Index, NumDimensions>, const std::conditional_t<std::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > > all() const { DimensionList<Index, NumDimensions> in_dims; return cast<bool>().reduce(in_dims, internal::AndReducer()); } template <typename Dims> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE - const TensorReductionOp<internal::OrReducer, const Dims, const std::conditional_t<internal::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > > + const TensorReductionOp<internal::OrReducer, const Dims, const std::conditional_t<std::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > > any(const Dims& dims) const { return cast<bool>().reduce(dims, internal::OrReducer()); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE - const TensorReductionOp<internal::OrReducer, const DimensionList<Index, NumDimensions>, const std::conditional_t<internal::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > > + const TensorReductionOp<internal::OrReducer, const DimensionList<Index, NumDimensions>, const std::conditional_t<std::is_same<bool, CoeffReturnType>::value, Derived, TensorConversionOp<bool, const Derived> > > any() const { DimensionList<Index, NumDimensions> in_dims; return cast<bool>().reduce(in_dims, internal::OrReducer());
diff --git a/unsupported/Eigen/src/Tensor/TensorBlock.h b/unsupported/Eigen/src/Tensor/TensorBlock.h index 45da4eb..66447af 100644 --- a/unsupported/Eigen/src/Tensor/TensorBlock.h +++ b/unsupported/Eigen/src/Tensor/TensorBlock.h
@@ -33,7 +33,7 @@ if (NumDims == 0) return strides; // TODO(ezhulenev): Use templates to unroll this loop (similar to - // h_array_reduce in CXX11meta.h)? Benchmark it. + // h_array_reduce in MoreMeta.h)? Benchmark it. if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) { strides[0] = 1; for (int i = 1; i < NumDims; ++i) { @@ -767,7 +767,7 @@ template <typename UnaryOp, typename ArgTensorBlock> class TensorCwiseUnaryBlock { - static constexpr bool NoArgBlockAccess = internal::is_void<typename ArgTensorBlock::XprType>::value; + static constexpr bool NoArgBlockAccess = std::is_void<typename ArgTensorBlock::XprType>::value; public: typedef std::conditional_t<NoArgBlockAccess, void, @@ -796,8 +796,8 @@ template <typename BinaryOp, typename LhsTensorBlock, typename RhsTensorBlock> class TensorCwiseBinaryBlock { - static constexpr bool NoArgBlockAccess = internal::is_void<typename LhsTensorBlock::XprType>::value || - internal::is_void<typename RhsTensorBlock::XprType>::value; + static constexpr bool NoArgBlockAccess = + std::is_void<typename LhsTensorBlock::XprType>::value || std::is_void<typename RhsTensorBlock::XprType>::value; public: typedef std::conditional_t< @@ -835,7 +835,7 @@ template <typename BlockFactory, typename ArgTensorBlock> class TensorUnaryExprBlock { typedef typename ArgTensorBlock::XprType ArgXprType; - static constexpr bool NoArgBlockAccess = internal::is_void<ArgXprType>::value; + static constexpr bool NoArgBlockAccess = std::is_void<ArgXprType>::value; public: typedef std::conditional_t<NoArgBlockAccess, void, typename BlockFactory::template XprType<ArgXprType>::type> XprType; @@ -865,9 +865,8 @@ typedef typename Arg2TensorBlock::XprType Arg2XprType; typedef typename Arg3TensorBlock::XprType Arg3XprType; - static constexpr bool NoArgBlockAccess = internal::is_void<Arg1XprType>::value || - internal::is_void<Arg2XprType>::value || - internal::is_void<Arg3XprType>::value; + static constexpr bool NoArgBlockAccess = + std::is_void<Arg1XprType>::value || std::is_void<Arg2XprType>::value || std::is_void<Arg3XprType>::value; public: typedef std::conditional_t<NoArgBlockAccess, void,
diff --git a/unsupported/Eigen/src/Tensor/TensorBroadcasting.h b/unsupported/Eigen/src/Tensor/TensorBroadcasting.h index e1b8bff..1362db4 100644 --- a/unsupported/Eigen/src/Tensor/TensorBroadcasting.h +++ b/unsupported/Eigen/src/Tensor/TensorBroadcasting.h
@@ -46,17 +46,11 @@ }; template <typename Dims> -struct is_input_scalar { - static constexpr bool value = false; -}; +struct is_input_scalar : std::false_type {}; template <> -struct is_input_scalar<Sizes<>> { - static constexpr bool value = true; -}; +struct is_input_scalar<Sizes<>> : std::true_type {}; template <typename std::ptrdiff_t... Indices> -struct is_input_scalar<Sizes<Indices...>> { - static constexpr bool value = (Sizes<Indices...>::total_size == 1); -}; +struct is_input_scalar<Sizes<Indices...>> : std::integral_constant<bool, Sizes<Indices...>::total_size == 1> {}; } // end namespace internal
diff --git a/unsupported/Eigen/src/Tensor/TensorContractionGpu.h b/unsupported/Eigen/src/Tensor/TensorContractionGpu.h index 93976d1..953bfa5 100644 --- a/unsupported/Eigen/src/Tensor/TensorContractionGpu.h +++ b/unsupported/Eigen/src/Tensor/TensorContractionGpu.h
@@ -1260,7 +1260,7 @@ typedef typename RightEvaluator::Dimensions RightDimensions; TensorEvaluator(const XprType& op, const Device& device) : Base(op, device) { - EIGEN_STATIC_ASSERT((internal::is_same<OutputKernelType, const NoOpOutputKernel>::value), + EIGEN_STATIC_ASSERT((std::is_same<OutputKernelType, const NoOpOutputKernel>::value), GPU_TENSOR_CONTRACTION_DOES_NOT_SUPPORT_OUTPUT_KERNELS); }
diff --git a/unsupported/Eigen/src/Tensor/TensorContractionSycl.h b/unsupported/Eigen/src/Tensor/TensorContractionSycl.h index 1ff7225..46af646 100644 --- a/unsupported/Eigen/src/Tensor/TensorContractionSycl.h +++ b/unsupported/Eigen/src/Tensor/TensorContractionSycl.h
@@ -247,8 +247,7 @@ template <data_source dt, typename PacketType, typename DataScalar> static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE - typename std::enable_if_t<Eigen::internal::unpacket_traits<PacketType>::size != 1 && dt == data_source::global_mem, - void> + std::enable_if_t<Eigen::internal::unpacket_traits<PacketType>::size != 1 && dt == data_source::global_mem, void> write(PacketType &packet_data, DataScalar *ptr) { ::Eigen::internal::pstoreu<DataScalar, PacketType>(ptr, packet_data); } @@ -268,8 +267,7 @@ */ template <data_source dt, typename PacketType, typename DataScalar> static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE - typename std::enable_if_t<Eigen::internal::unpacket_traits<PacketType>::size == 1 && dt == data_source::global_mem, - void> + std::enable_if_t<Eigen::internal::unpacket_traits<PacketType>::size == 1 && dt == data_source::global_mem, void> write(PacketType &packet_data, DataScalar *ptr) { *ptr = packet_data; }
diff --git a/unsupported/Eigen/src/Tensor/TensorConversion.h b/unsupported/Eigen/src/Tensor/TensorConversion.h index 6a9b045..88c04cb 100644 --- a/unsupported/Eigen/src/Tensor/TensorConversion.h +++ b/unsupported/Eigen/src/Tensor/TensorConversion.h
@@ -305,7 +305,7 @@ typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<SrcType, Device>::type PacketSourceType; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size; - static constexpr bool IsSameType = internal::is_same<TargetType, SrcType>::value; + static constexpr bool IsSameType = std::is_same<TargetType, SrcType>::value; typedef StorageMemory<CoeffReturnType, Device> Storage; typedef typename Storage::Type EvaluatorPointerType;
diff --git a/unsupported/Eigen/src/Tensor/TensorDimensions.h b/unsupported/Eigen/src/Tensor/TensorDimensions.h index 91eec4c..5001083 100644 --- a/unsupported/Eigen/src/Tensor/TensorDimensions.h +++ b/unsupported/Eigen/src/Tensor/TensorDimensions.h
@@ -20,8 +20,14 @@ namespace internal { template <std::ptrdiff_t n, typename Dimension> -struct dget { - static constexpr std::ptrdiff_t value = get<n, Dimension>::value; +struct dget; + +template <std::ptrdiff_t n, typename T, T first, T... rest> +struct dget<n, std::integer_sequence<T, first, rest...>> : dget<n - 1, std::integer_sequence<T, rest...>> {}; + +template <typename T, T first, T... rest> +struct dget<0, std::integer_sequence<T, first, rest...>> { + static constexpr T value = first; }; template <typename Index, std::ptrdiff_t NumIndices, std::ptrdiff_t n, bool RowMajor> @@ -50,7 +56,7 @@ template <typename Dimensions> constexpr EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index run(const Index index, const Dimensions& dimensions) { const Index mult = (index == n - 1) ? 1 : 0; - return array_get<n - 1>(dimensions) * mult + + return dget<n - 1, Dimensions>::value * mult + fixed_size_tensor_index_extraction_helper<Index, n - 1>::run(index, dimensions); } }; @@ -79,12 +85,12 @@ */ template <typename std::ptrdiff_t... Indices> struct Sizes { - typedef internal::numeric_list<std::ptrdiff_t, Indices...> Base; + typedef std::integer_sequence<std::ptrdiff_t, Indices...> Base; const Base t = Base(); static constexpr std::ptrdiff_t total_size = internal::arg_prod(Indices...); - static constexpr ptrdiff_t count = Base::count; + static constexpr ptrdiff_t count = sizeof...(Indices); - constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t rank() const { return Base::count; } + constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t rank() const { return count; } static constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t TotalSize() { return internal::arg_prod(Indices...); @@ -92,7 +98,7 @@ constexpr EIGEN_DEVICE_FUNC Sizes() {} template <typename DenseIndex> - explicit constexpr EIGEN_DEVICE_FUNC Sizes(const array<DenseIndex, Base::count>& /*indices*/) { + explicit constexpr EIGEN_DEVICE_FUNC Sizes(const array<DenseIndex, count>& /*indices*/) { // TODO: Add assertion. } template <typename... DenseIndex> @@ -108,20 +114,18 @@ } constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t operator[](const std::ptrdiff_t index) const { - return internal::fixed_size_tensor_index_extraction_helper<std::ptrdiff_t, Base::count>::run(index, t); + return internal::fixed_size_tensor_index_extraction_helper<std::ptrdiff_t, count>::run(index, t); } template <typename DenseIndex> constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ptrdiff_t - IndexOfColMajor(const array<DenseIndex, Base::count>& indices) const { - return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count, false>::run( - indices, t); + IndexOfColMajor(const array<DenseIndex, count>& indices) const { + return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, count, count, false>::run(indices, t); } template <typename DenseIndex> constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ptrdiff_t - IndexOfRowMajor(const array<DenseIndex, Base::count>& indices) const { - return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count, true>::run( - indices, t); + IndexOfRowMajor(const array<DenseIndex, count>& indices) const { + return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, count, count, true>::run(indices, t); } }; @@ -202,8 +206,8 @@ EIGEN_DEVICE_FUNC explicit DSizes( const array<OtherIndex, NumDims>& other, std::enable_if_t< - internal::is_same<DenseIndex, typename internal::promote_index_type<DenseIndex, OtherIndex>::type>::value, - void*> = 0) { + std::is_same<DenseIndex, typename internal::promote_index_type<DenseIndex, OtherIndex>::type>::value, void*> = + 0) { for (int i = 0; i < NumDims; ++i) { (*this)[i] = static_cast<DenseIndex>(other[i]); } @@ -301,7 +305,7 @@ }; template <std::ptrdiff_t n, typename std::ptrdiff_t... Indices> constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t array_get(const Sizes<Indices...>&) { - return get<n, internal::numeric_list<std::ptrdiff_t, Indices...> >::value; + return dget<n, typename Sizes<Indices...>::Base>::value; } template <std::ptrdiff_t n> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t array_get(const Sizes<>&) {
diff --git a/unsupported/Eigen/src/Tensor/TensorEvaluator.h b/unsupported/Eigen/src/Tensor/TensorEvaluator.h index bfc4f0e..bb48bd5 100644 --- a/unsupported/Eigen/src/Tensor/TensorEvaluator.h +++ b/unsupported/Eigen/src/Tensor/TensorEvaluator.h
@@ -609,18 +609,18 @@ internal::traits<XprType>::NumDimensions <= 1), YOU_MADE_A_PROGRAMMING_MISTAKE); - EIGEN_STATIC_ASSERT((internal::is_same<typename internal::traits<Arg1Type>::StorageKind, - typename internal::traits<Arg2Type>::StorageKind>::value), + EIGEN_STATIC_ASSERT((std::is_same<typename internal::traits<Arg1Type>::StorageKind, + typename internal::traits<Arg2Type>::StorageKind>::value), STORAGE_KIND_MUST_MATCH) - EIGEN_STATIC_ASSERT((internal::is_same<typename internal::traits<Arg1Type>::StorageKind, - typename internal::traits<Arg3Type>::StorageKind>::value), + EIGEN_STATIC_ASSERT((std::is_same<typename internal::traits<Arg1Type>::StorageKind, + typename internal::traits<Arg3Type>::StorageKind>::value), STORAGE_KIND_MUST_MATCH) - EIGEN_STATIC_ASSERT((internal::is_same<typename internal::traits<Arg1Type>::Index, - typename internal::traits<Arg2Type>::Index>::value), - STORAGE_INDEX_MUST_MATCH) - EIGEN_STATIC_ASSERT((internal::is_same<typename internal::traits<Arg1Type>::Index, - typename internal::traits<Arg3Type>::Index>::value), - STORAGE_INDEX_MUST_MATCH) + EIGEN_STATIC_ASSERT( + (std::is_same<typename internal::traits<Arg1Type>::Index, typename internal::traits<Arg2Type>::Index>::value), + STORAGE_INDEX_MUST_MATCH) + EIGEN_STATIC_ASSERT( + (std::is_same<typename internal::traits<Arg1Type>::Index, typename internal::traits<Arg3Type>::Index>::value), + STORAGE_INDEX_MUST_MATCH) eigen_assert(dimensions_match(m_arg1Impl.dimensions(), m_arg2Impl.dimensions()) && dimensions_match(m_arg1Impl.dimensions(), m_arg3Impl.dimensions()));
diff --git a/unsupported/Eigen/src/Tensor/TensorExecutor.h b/unsupported/Eigen/src/Tensor/TensorExecutor.h index 2053c98..faef9f3 100644 --- a/unsupported/Eigen/src/Tensor/TensorExecutor.h +++ b/unsupported/Eigen/src/Tensor/TensorExecutor.h
@@ -29,31 +29,23 @@ // TODO(ezhulenev): Add specializations for all other types of Tensor ops. template <typename Expression> -struct ExpressionHasTensorBroadcastingOp { - enum { value = false }; -}; +struct ExpressionHasTensorBroadcastingOp : std::false_type {}; template <typename LhsXprType, typename RhsXprType> -struct ExpressionHasTensorBroadcastingOp<const TensorAssignOp<LhsXprType, RhsXprType> > { - enum { value = ExpressionHasTensorBroadcastingOp<RhsXprType>::value }; -}; +struct ExpressionHasTensorBroadcastingOp<const TensorAssignOp<LhsXprType, RhsXprType> > + : ExpressionHasTensorBroadcastingOp<RhsXprType> {}; template <typename UnaryOp, typename XprType> -struct ExpressionHasTensorBroadcastingOp<const TensorCwiseUnaryOp<UnaryOp, XprType> > { - enum { value = ExpressionHasTensorBroadcastingOp<XprType>::value }; -}; +struct ExpressionHasTensorBroadcastingOp<const TensorCwiseUnaryOp<UnaryOp, XprType> > + : ExpressionHasTensorBroadcastingOp<XprType> {}; template <typename BinaryOp, typename LhsXprType, typename RhsXprType> -struct ExpressionHasTensorBroadcastingOp<const TensorCwiseBinaryOp<BinaryOp, LhsXprType, RhsXprType> > { - enum { - value = ExpressionHasTensorBroadcastingOp<LhsXprType>::value || ExpressionHasTensorBroadcastingOp<RhsXprType>::value - }; -}; +struct ExpressionHasTensorBroadcastingOp<const TensorCwiseBinaryOp<BinaryOp, LhsXprType, RhsXprType> > + : std::integral_constant<bool, ExpressionHasTensorBroadcastingOp<LhsXprType>::value || + ExpressionHasTensorBroadcastingOp<RhsXprType>::value> {}; template <typename Broadcast, typename XprType> -struct ExpressionHasTensorBroadcastingOp<const TensorBroadcastingOp<Broadcast, XprType> > { - enum { value = true }; -}; +struct ExpressionHasTensorBroadcastingOp<const TensorBroadcastingOp<Broadcast, XprType> > : std::true_type {}; // -------------------------------------------------------------------------- //
diff --git a/unsupported/Eigen/src/Tensor/TensorFFT.h b/unsupported/Eigen/src/Tensor/TensorFFT.h index ffe16d9..4bb98b0 100644 --- a/unsupported/Eigen/src/Tensor/TensorFFT.h +++ b/unsupported/Eigen/src/Tensor/TensorFFT.h
@@ -235,12 +235,12 @@ private: EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalToBuf(EvaluatorPointerType data) { - const bool write_to_out = internal::is_same<OutputScalar, ComplexScalar>::value; + const bool write_to_out = std::is_same<OutputScalar, ComplexScalar>::value; ComplexScalar* buf = write_to_out ? (ComplexScalar*)data : (ComplexScalar*)m_device.allocate(sizeof(ComplexScalar) * m_size); for (Index i = 0; i < m_size; ++i) { - buf[i] = MakeComplex<internal::is_same<InputScalar, RealScalar>::value>()(m_impl.coeff(i)); + buf[i] = MakeComplex<std::is_same<InputScalar, RealScalar>::value>()(m_impl.coeff(i)); } for (size_t i = 0; i < m_fft.size(); ++i) {
diff --git a/unsupported/Eigen/src/Tensor/TensorFixedSize.h b/unsupported/Eigen/src/Tensor/TensorFixedSize.h index 5fa966b..5006b54 100644 --- a/unsupported/Eigen/src/Tensor/TensorFixedSize.h +++ b/unsupported/Eigen/src/Tensor/TensorFixedSize.h
@@ -199,12 +199,6 @@ protected: EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool checkIndexRange(const array<Index, NumIndices>& /*indices*/) const { - using internal::array_apply_and_reduce; - using internal::array_zip_and_reduce; - using internal::greater_equal_zero_op; - using internal::lesser_op; - using internal::logical_and_op; - return true; }
diff --git a/unsupported/Eigen/src/Tensor/TensorIO.h b/unsupported/Eigen/src/Tensor/TensorIO.h index 8ef2aaa..381555c 100644 --- a/unsupported/Eigen/src/Tensor/TensorIO.h +++ b/unsupported/Eigen/src/Tensor/TensorIO.h
@@ -221,13 +221,14 @@ typedef typename Tensor::Index IndexType; eigen_assert(Tensor::Layout == RowMajor); - typedef std::conditional_t<is_same<Scalar, char>::value || is_same<Scalar, unsigned char>::value || - is_same<Scalar, numext::int8_t>::value || is_same<Scalar, numext::uint8_t>::value, + typedef std::conditional_t<std::is_same<Scalar, char>::value || std::is_same<Scalar, unsigned char>::value || + std::is_same<Scalar, numext::int8_t>::value || + std::is_same<Scalar, numext::uint8_t>::value, int, - std::conditional_t<is_same<Scalar, std::complex<char>>::value || - is_same<Scalar, std::complex<unsigned char>>::value || - is_same<Scalar, std::complex<numext::int8_t>>::value || - is_same<Scalar, std::complex<numext::uint8_t>>::value, + std::conditional_t<std::is_same<Scalar, std::complex<char>>::value || + std::is_same<Scalar, std::complex<unsigned char>>::value || + std::is_same<Scalar, std::complex<numext::int8_t>>::value || + std::is_same<Scalar, std::complex<numext::uint8_t>>::value, std::complex<int>, const Scalar&>> PrintType;
diff --git a/unsupported/Eigen/src/Tensor/TensorIndexList.h b/unsupported/Eigen/src/Tensor/TensorIndexList.h index 4b85fad..dbf3227 100644 --- a/unsupported/Eigen/src/Tensor/TensorIndexList.h +++ b/unsupported/Eigen/src/Tensor/TensorIndexList.h
@@ -73,43 +73,16 @@ } template <typename T> -struct is_compile_time_constant { - static constexpr bool value = false; -}; - -template <Index idx> -struct is_compile_time_constant<type2index<idx>> { - static constexpr bool value = true; -}; -template <Index idx> -struct is_compile_time_constant<const type2index<idx>> { - static constexpr bool value = true; -}; -template <Index idx> -struct is_compile_time_constant<type2index<idx>&> { - static constexpr bool value = true; -}; -template <Index idx> -struct is_compile_time_constant<const type2index<idx>&> { - static constexpr bool value = true; -}; +struct is_compile_time_constant_impl : std::false_type {}; template <Index f, Index s> -struct is_compile_time_constant<type2indexpair<f, s>> { - static constexpr bool value = true; -}; -template <Index f, Index s> -struct is_compile_time_constant<const type2indexpair<f, s>> { - static constexpr bool value = true; -}; -template <Index f, Index s> -struct is_compile_time_constant<type2indexpair<f, s>&> { - static constexpr bool value = true; -}; -template <Index f, Index s> -struct is_compile_time_constant<const type2indexpair<f, s>&> { - static constexpr bool value = true; -}; +struct is_compile_time_constant_impl<type2indexpair<f, s>> : std::true_type {}; + +template <Index idx> +struct is_compile_time_constant_impl<type2index<idx>> : std::true_type {}; + +template <typename T> +struct is_compile_time_constant : is_compile_time_constant_impl<std::remove_cv_t<std::remove_reference_t<T>>> {}; template <typename... T> struct IndexTuple;
diff --git a/unsupported/Eigen/src/Tensor/TensorMeta.h b/unsupported/Eigen/src/Tensor/TensorMeta.h index d59d890..bac0e7b 100644 --- a/unsupported/Eigen/src/Tensor/TensorMeta.h +++ b/unsupported/Eigen/src/Tensor/TensorMeta.h
@@ -253,38 +253,21 @@ template <typename IndexType, typename Index, Index First, Index... Is> constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE array<Index, 1 + sizeof...(Is)> customIndices2Array( - IndexType& idx, numeric_list<Index, First, Is...>) { + IndexType& idx, std::integer_sequence<Index, First, Is...>) { return {static_cast<Index>(idx[First]), static_cast<Index>(idx[Is])...}; } template <typename IndexType, typename Index> -constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE array<Index, 0> customIndices2Array(IndexType&, numeric_list<Index>) { +constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE array<Index, 0> customIndices2Array(IndexType&, + std::integer_sequence<Index>) { return array<Index, 0>(); } /** Make an array (for index/dimensions) out of a custom index */ template <typename Index, std::size_t NumIndices, typename IndexType> constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE array<Index, NumIndices> customIndices2Array(IndexType& idx) { - return customIndices2Array(idx, typename gen_numeric_list<Index, NumIndices>::type{}); + return customIndices2Array(idx, std::make_integer_sequence<Index, NumIndices>{}); } -template <typename B, typename D> -struct is_base_of { - typedef char (&yes)[1]; - typedef char (&no)[2]; - - template <typename BB, typename DD> - struct Host { - operator BB*() const; - operator DD*(); - }; - - template <typename T> - static yes check(D*, T); - static no check(B*, int); - - static constexpr bool value = sizeof(check(Host<B, D>(), int())) == sizeof(yes); -}; - } // namespace internal } // namespace Eigen
diff --git a/unsupported/Eigen/src/Tensor/TensorReduction.h b/unsupported/Eigen/src/Tensor/TensorReduction.h index d7091c8..547fa84 100644 --- a/unsupported/Eigen/src/Tensor/TensorReduction.h +++ b/unsupported/Eigen/src/Tensor/TensorReduction.h
@@ -556,10 +556,10 @@ // For full reductions #if defined(EIGEN_USE_GPU) && (defined(EIGEN_GPUCC)) - static constexpr bool RunningOnGPU = internal::is_same<Device, Eigen::GpuDevice>::value; + static constexpr bool RunningOnGPU = std::is_same<Device, Eigen::GpuDevice>::value; static constexpr bool RunningOnSycl = false; #elif defined(EIGEN_USE_SYCL) - static constexpr bool RunningOnSycl = internal::is_same<internal::remove_all_t<Device>, Eigen::SyclDevice>::value; + static constexpr bool RunningOnSycl = std::is_same<internal::remove_all_t<Device>, Eigen::SyclDevice>::value; static constexpr bool RunningOnGPU = false; #else static constexpr bool RunningOnGPU = false;
diff --git a/unsupported/Eigen/src/Tensor/TensorReductionGpu.h b/unsupported/Eigen/src/Tensor/TensorReductionGpu.h index 48fbecb..944e765 100644 --- a/unsupported/Eigen/src/Tensor/TensorReductionGpu.h +++ b/unsupported/Eigen/src/Tensor/TensorReductionGpu.h
@@ -390,8 +390,7 @@ template <typename Self, typename Op, typename OutputType, bool PacketAccess> struct FullReductionLauncher< Self, Op, OutputType, PacketAccess, - std::enable_if_t<internal::is_same<float, OutputType>::value || internal::is_same<double, OutputType>::value, - void>> { + std::enable_if_t<std::is_same<float, OutputType>::value || std::is_same<double, OutputType>::value, void>> { static void run(const Self& self, Op& reducer, const GpuDevice& device, OutputType* output, typename Self::Index num_coeffs) { typedef typename Self::Index Index; @@ -451,9 +450,9 @@ // of doubles, floats and half floats // Half-float reduction specializations. static constexpr bool HasOptimizedImplementation = - !Self::ReducerTraits::IsStateful && (internal::is_same<typename Self::CoeffReturnType, float>::value || - internal::is_same<typename Self::CoeffReturnType, double>::value || - (internal::is_same<typename Self::CoeffReturnType, Eigen::half>::value && + !Self::ReducerTraits::IsStateful && (std::is_same<typename Self::CoeffReturnType, float>::value || + std::is_same<typename Self::CoeffReturnType, double>::value || + (std::is_same<typename Self::CoeffReturnType, Eigen::half>::value && reducer_traits<Op, GpuDevice>::PacketAccess)); template <typename OutputType> @@ -713,8 +712,7 @@ template <typename Self, typename Op, typename OutputType, bool PacketAccess> struct InnerReductionLauncher< Self, Op, OutputType, PacketAccess, - std::enable_if_t<internal::is_same<float, OutputType>::value || internal::is_same<double, OutputType>::value, - void>> { + std::enable_if_t<std::is_same<float, OutputType>::value || std::is_same<double, OutputType>::value, void>> { static bool run(const Self& self, Op& reducer, const GpuDevice& device, OutputType* output, typename Self::Index num_coeffs_to_reduce, typename Self::Index num_preserved_vals) { typedef typename Self::Index Index; @@ -791,9 +789,9 @@ // of floats and half floats. // Half-float reduction specializations. static constexpr bool HasOptimizedImplementation = - !Self::ReducerTraits::IsStateful && (internal::is_same<typename Self::CoeffReturnType, float>::value || - internal::is_same<typename Self::CoeffReturnType, double>::value || - (internal::is_same<typename Self::CoeffReturnType, Eigen::half>::value && + !Self::ReducerTraits::IsStateful && (std::is_same<typename Self::CoeffReturnType, float>::value || + std::is_same<typename Self::CoeffReturnType, double>::value || + (std::is_same<typename Self::CoeffReturnType, Eigen::half>::value && reducer_traits<Op, GpuDevice>::PacketAccess)); template <typename OutputType> @@ -851,8 +849,8 @@ // so reduce the scope of the optimized version of the code to the simple case // of floats. static constexpr bool HasOptimizedImplementation = - !Self::ReducerTraits::IsStateful && (internal::is_same<typename Self::CoeffReturnType, float>::value || - internal::is_same<typename Self::CoeffReturnType, double>::value); + !Self::ReducerTraits::IsStateful && (std::is_same<typename Self::CoeffReturnType, float>::value || + std::is_same<typename Self::CoeffReturnType, double>::value); template <typename Device, typename OutputType> static #if !defined(EIGEN_HIPCC)
diff --git a/unsupported/Eigen/src/Tensor/TensorTraits.h b/unsupported/Eigen/src/Tensor/TensorTraits.h index 1b539f7..007ed1d 100644 --- a/unsupported/Eigen/src/Tensor/TensorTraits.h +++ b/unsupported/Eigen/src/Tensor/TensorTraits.h
@@ -17,31 +17,33 @@ namespace Eigen { namespace internal { -template <typename Scalar, int Options> -class compute_tensor_flags { +template <int Options> +struct tensor_alignment_for_options { enum { is_dynamic_size_storage = 1, - is_aligned = (((Options & DontAlign) == 0) && ( + value = (((Options & DontAlign) == 0) && ( #if EIGEN_MAX_STATIC_ALIGN_BYTES > 0 - (!is_dynamic_size_storage) + (!is_dynamic_size_storage) #else - 0 + 0 #endif - | + | #if EIGEN_MAX_ALIGN_BYTES > 0 - is_dynamic_size_storage + is_dynamic_size_storage #else - 0 + 0 #endif - )), - packet_access_bit = packet_traits<Scalar>::Vectorizable && is_aligned ? PacketAccessBit : 0 + )) }; - - public: - enum { ret = packet_access_bit }; }; +template <typename Scalar, int Options> +struct compute_tensor_flags + : std::integral_constant<int, packet_traits<Scalar>::Vectorizable && tensor_alignment_for_options<Options>::value + ? PacketAccessBit + : 0> {}; + template <typename Scalar_, int NumIndices_, int Options_, typename IndexType_> struct traits<Tensor<Scalar_, NumIndices_, Options_, IndexType_> > { typedef Scalar_ Scalar; @@ -51,7 +53,7 @@ static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor; enum { Options = Options_, - Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0 : LvalueBit) + Flags = compute_tensor_flags<Scalar_, Options_>::value | (std::is_const<Scalar_>::value ? 0 : LvalueBit) }; template <typename T> struct MakePointer { @@ -69,7 +71,7 @@ static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor; enum { Options = Options_, - Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0 : LvalueBit) + Flags = compute_tensor_flags<Scalar_, Options_>::value | (std::is_const<Scalar_>::value ? 0 : LvalueBit) }; template <typename T> struct MakePointer {
diff --git a/unsupported/Eigen/src/TensorSymmetry/DynamicSymmetry.h b/unsupported/Eigen/src/TensorSymmetry/DynamicSymmetry.h index 44dcf68..d734bb1 100644 --- a/unsupported/Eigen/src/TensorSymmetry/DynamicSymmetry.h +++ b/unsupported/Eigen/src/TensorSymmetry/DynamicSymmetry.h
@@ -61,8 +61,8 @@ eigen_assert(N >= m_numIndices && "Can only apply symmetry group to objects that have at least the required amount of indices."); for (std::size_t i = 0; i < size(); i++) - initial = Op::run(h_permute(i, idx, typename internal::gen_numeric_list<int, N>::type()), m_elements[i].flags, - initial, std::forward<Args>(args)...); + initial = Op::run(h_permute(i, idx, std::make_integer_sequence<int, N>{}), m_elements[i].flags, initial, + std::forward<Args>(args)...); return initial; } @@ -117,7 +117,7 @@ template <typename Index, std::size_t N, int... n> inline std::array<Index, N> h_permute(std::size_t which, const std::array<Index, N>& idx, - internal::numeric_list<int, n...>) const { + std::integer_sequence<int, n...>) const { return std::array<Index, N>{{idx[n >= m_numIndices ? n : m_elements[which].representation[n]]...}}; }
diff --git a/unsupported/Eigen/src/TensorSymmetry/StaticSymmetry.h b/unsupported/Eigen/src/TensorSymmetry/StaticSymmetry.h index b7402db..7c2eccb 100644 --- a/unsupported/Eigen/src/TensorSymmetry/StaticSymmetry.h +++ b/unsupported/Eigen/src/TensorSymmetry/StaticSymmetry.h
@@ -22,7 +22,7 @@ struct tensor_static_symgroup_permutate; template <int... nn> -struct tensor_static_symgroup_permutate<numeric_list<int, nn...>> { +struct tensor_static_symgroup_permutate<std::integer_sequence<int, nn...>> { constexpr static std::size_t N = sizeof...(nn); template <typename T> @@ -37,23 +37,30 @@ constexpr static int flags = flags_; }; +template <typename Gen, int... indices> +constexpr std::integer_sequence<int, + ((indices == Gen::One) ? Gen::Two : ((indices == Gen::Two) ? Gen::One : indices))...> +tensor_static_symgroup_swapped_indices(std::integer_sequence<int, indices...>) { + return {}; +} + template <typename Gen, int N> struct tensor_static_symgroup_element_ctor { - typedef tensor_static_symgroup_element<typename gen_numeric_list_swapped_pair<int, N, Gen::One, Gen::Two>::type, - Gen::Flags> + typedef tensor_static_symgroup_element< + decltype(tensor_static_symgroup_swapped_indices<Gen>(std::make_integer_sequence<int, N>{})), Gen::Flags> type; }; template <int N> struct tensor_static_symgroup_identity_ctor { - typedef tensor_static_symgroup_element<typename gen_numeric_list<int, N>::type, 0> type; + typedef tensor_static_symgroup_element<std::make_integer_sequence<int, N>, 0> type; }; template <typename iib> struct tensor_static_symgroup_multiply_helper { template <int... iia> - constexpr static numeric_list<int, get<iia, iib>::value...> helper(numeric_list<int, iia...>) { - return numeric_list<int, get<iia, iib>::value...>(); + constexpr static std::integer_sequence<int, get<iia, iib>::value...> helper(std::integer_sequence<int, iia...>) { + return {}; } }; @@ -66,7 +73,7 @@ constexpr static int ffb = B::flags; public: - static_assert(iia::count == iib::count, "Cannot multiply symmetry elements with different number of indices."); + static_assert(iia::size() == iib::size(), "Cannot multiply symmetry elements with different number of indices."); typedef tensor_static_symgroup_element<decltype(tensor_static_symgroup_multiply_helper<iib>::helper(iia())), ffa ^ ffb> @@ -79,9 +86,9 @@ typedef typename B::indices iib; constexpr static int ffa = A::flags; constexpr static int ffb = B::flags; - static_assert(iia::count == iib::count, "Cannot compare symmetry elements with different number of indices."); + static_assert(iia::size() == iib::size(), "Cannot compare symmetry elements with different number of indices."); - constexpr static bool value = is_same<iia, iib>::value; + constexpr static bool value = std::is_same<iia, iib>::value; private: /* this should be zero if they are identical, or else the tensor @@ -109,14 +116,14 @@ template <typename Index, std::size_t N, int... ii, int... jj> constexpr static std::array<Index, N> tensor_static_symgroup_index_permute(std::array<Index, N> idx, - internal::numeric_list<int, ii...>, - internal::numeric_list<int, jj...>) { - return {{idx[ii]..., idx[jj]...}}; + std::integer_sequence<int, ii...>, + std::integer_sequence<int, jj...>) { + return {{idx[ii]..., idx[sizeof...(ii) + jj]...}}; } template <typename Index, int... ii> static inline std::vector<Index> tensor_static_symgroup_index_permute(std::vector<Index> idx, - internal::numeric_list<int, ii...>) { + std::integer_sequence<int, ii...>) { std::vector<Index> result{{idx[ii]...}}; std::size_t target_size = idx.size(); for (std::size_t i = result.size(); i < target_size; i++) result.push_back(idx[i]); @@ -133,8 +140,8 @@ static inline RV run(const std::array<Index, NumIndices>& idx, RV initial, Args&&... args) { static_assert(NumIndices >= SGNumIndices, "Can only apply symmetry group to objects that have at least the required amount of indices."); - typedef typename internal::gen_numeric_list<int, NumIndices - SGNumIndices, SGNumIndices>::type remaining_indices; - initial = Op::run(tensor_static_symgroup_index_permute(idx, typename first::indices(), remaining_indices()), + initial = Op::run(tensor_static_symgroup_index_permute( + idx, typename first::indices(), std::make_integer_sequence<int, NumIndices - SGNumIndices>{}), first::flags, initial, std::forward<Args>(args)...); return tensor_static_symgroup_do_apply<internal::type_list<next...>>::template run<Op, RV, SGNumIndices>( idx, initial, args...);
diff --git a/unsupported/Eigen/src/TensorSymmetry/util/TemplateGroupTheory.h b/unsupported/Eigen/src/TensorSymmetry/util/TemplateGroupTheory.h index 8421679..b290bcb 100644 --- a/unsupported/Eigen/src/TensorSymmetry/util/TemplateGroupTheory.h +++ b/unsupported/Eigen/src/TensorSymmetry/util/TemplateGroupTheory.h
@@ -68,7 +68,7 @@ * * The main interface for Dimino's algorithm is the template * enumerate_group_elements. All lists are implemented as variadic - * type_list<typename...> and numeric_list<typename = int, int...> + * type_list<typename...> and std::integer_sequence<int, ...> * templates. * * 'Calling' templates is usually done via typedefs.
diff --git a/unsupported/Eigen/src/TensorUtil/CXX11Meta.h b/unsupported/Eigen/src/TensorUtil/CXX11Meta.h deleted file mode 100644 index 995a4f5..0000000 --- a/unsupported/Eigen/src/TensorUtil/CXX11Meta.h +++ /dev/null
@@ -1,19 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2013 Christian Seiler <christian@iwakd.de> -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -// SPDX-License-Identifier: MPL-2.0 - -#ifndef EIGEN_CXX11META_H -#define EIGEN_CXX11META_H - -#include <vector> -#include "../../../../Eigen/src/Core/util/EmulateArray.h" - -#include "CXX11Workarounds.h" - -#endif // EIGEN_CXX11META_H
diff --git a/unsupported/Eigen/src/TensorUtil/CXX11Workarounds.h b/unsupported/Eigen/src/TensorUtil/CXX11Workarounds.h deleted file mode 100644 index 8142175..0000000 --- a/unsupported/Eigen/src/TensorUtil/CXX11Workarounds.h +++ /dev/null
@@ -1,42 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2013 Christian Seiler <christian@iwakd.de> -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -// SPDX-License-Identifier: MPL-2.0 - -#ifndef EIGEN_CXX11WORKAROUNDS_H -#define EIGEN_CXX11WORKAROUNDS_H - -namespace Eigen { - -namespace internal { - -/* array_get overloads for std::vector, used by tensor code. - */ - -template <std::size_t I_, class T> -constexpr T& array_get(std::vector<T>& a) { - return a[I_]; -} -template <std::size_t I_, class T> -constexpr T&& array_get(std::vector<T>&& a) { - return a[I_]; -} -template <std::size_t I_, class T> -constexpr T const& array_get(std::vector<T> const& a) { - return a[I_]; -} - -} // end namespace internal - -} // end namespace Eigen - -#endif // EIGEN_CXX11WORKAROUNDS_H - -/* - * kate: space-indent on; indent-width 2; mixedindent off; indent-mode cstyle; - */
diff --git a/unsupported/test/autodiff_scalar.cpp b/unsupported/test/autodiff_scalar.cpp index 89bd929..64845b3 100644 --- a/unsupported/test/autodiff_scalar.cpp +++ b/unsupported/test/autodiff_scalar.cpp
@@ -82,7 +82,7 @@ typedef std::numeric_limits<Scalar> B; // workaround "unused typedef" warning: - VERIFY(!bool(internal::is_same<B, A>::value)); + VERIFY(!bool(std::is_same<B, A>::value)); VERIFY(bool(std::is_base_of<B, A>::value)); }
diff --git a/unsupported/test/polynomialsolver.cpp b/unsupported/test/polynomialsolver.cpp index df9f04c..c534b9a 100644 --- a/unsupported/test/polynomialsolver.cpp +++ b/unsupported/test/polynomialsolver.cpp
@@ -18,9 +18,7 @@ namespace Eigen { namespace internal { template <int Size> -struct increment_if_fixed_size { - enum { ret = (Size == Dynamic) ? Dynamic : Size + 1 }; -}; +struct increment_if_fixed_size : std::integral_constant<int, (Size == Dynamic) ? Dynamic : Size + 1> {}; } // namespace internal } // namespace Eigen @@ -165,7 +163,7 @@ void polynomialsolver(int deg) { typedef typename NumTraits<Scalar_>::Real RealScalar; typedef internal::increment_if_fixed_size<Deg_> Dim; - typedef Matrix<Scalar_, Dim::ret, 1> PolynomialType; + typedef Matrix<Scalar_, Dim::value, 1> PolynomialType; typedef Matrix<Scalar_, Deg_, 1> EvalRootsType; typedef Matrix<RealScalar, Deg_, 1> RealRootsType;
diff --git a/unsupported/test/polynomialutils.cpp b/unsupported/test/polynomialutils.cpp index 14df714..d43c9f7 100644 --- a/unsupported/test/polynomialutils.cpp +++ b/unsupported/test/polynomialutils.cpp
@@ -17,16 +17,14 @@ namespace Eigen { namespace internal { template <int Size> -struct increment_if_fixed_size { - enum { ret = (Size == Dynamic) ? Dynamic : Size + 1 }; -}; +struct increment_if_fixed_size : std::integral_constant<int, (Size == Dynamic) ? Dynamic : Size + 1> {}; } // namespace internal } // namespace Eigen template <typename Scalar_, int Deg_> void realRoots_to_monicPolynomial_test(int deg) { typedef internal::increment_if_fixed_size<Deg_> Dim; - typedef Matrix<Scalar_, Dim::ret, 1> PolynomialType; + typedef Matrix<Scalar_, Dim::value, 1> PolynomialType; typedef Matrix<Scalar_, Deg_, 1> EvalRootsType; PolynomialType pols(deg + 1); @@ -61,7 +59,7 @@ template <typename Scalar_, int Deg_> void CauchyBounds(int deg) { typedef internal::increment_if_fixed_size<Deg_> Dim; - typedef Matrix<Scalar_, Dim::ret, 1> PolynomialType; + typedef Matrix<Scalar_, Dim::value, 1> PolynomialType; typedef Matrix<Scalar_, Deg_, 1> EvalRootsType; PolynomialType pols(deg + 1);
diff --git a/unsupported/test/sparse_extra.cpp b/unsupported/test/sparse_extra.cpp index 4c0c3a2..7a2ac9a 100644 --- a/unsupported/test/sparse_extra.cpp +++ b/unsupported/test/sparse_extra.cpp
@@ -75,7 +75,7 @@ // test coeff and coeffRef for (int i = 0; i < (int)zeroCoords.size(); ++i) { VERIFY_IS_MUCH_SMALLER_THAN(m.coeff(zeroCoords[i].x(), zeroCoords[i].y()), eps); - if (internal::is_same<SparseMatrixType, SparseMatrix<Scalar, Flags> >::value) + if (std::is_same<SparseMatrixType, SparseMatrix<Scalar, Flags> >::value) VERIFY_RAISES_ASSERT(m.coeffRef(zeroCoords[0].x(), zeroCoords[0].y()) = 5); } VERIFY_IS_APPROX(m, refMat);