mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Replace Eigen type metaprogramming with corresponding std types and make use of alias templates
This commit is contained in:
committed by
Antonio Sánchez
parent
514f90c9ff
commit
421cbf0866
@@ -1418,19 +1418,19 @@ innerVectors(Index outerStart, Index outerSize) const
|
||||
*/
|
||||
template<DirectionType Direction>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
typename internal::conditional<Direction==Vertical,ColXpr,RowXpr>::type
|
||||
std::conditional_t<Direction==Vertical,ColXpr,RowXpr>
|
||||
subVector(Index i)
|
||||
{
|
||||
return typename internal::conditional<Direction==Vertical,ColXpr,RowXpr>::type(derived(),i);
|
||||
return std::conditional_t<Direction==Vertical,ColXpr,RowXpr>(derived(),i);
|
||||
}
|
||||
|
||||
/** This is the const version of subVector(Index) */
|
||||
template<DirectionType Direction>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
typename internal::conditional<Direction==Vertical,ConstColXpr,ConstRowXpr>::type
|
||||
std::conditional_t<Direction==Vertical,ConstColXpr,ConstRowXpr>
|
||||
subVector(Index i) const
|
||||
{
|
||||
return typename internal::conditional<Direction==Vertical,ConstColXpr,ConstRowXpr>::type(derived(),i);
|
||||
return std::conditional_t<Direction==Vertical,ConstColXpr,ConstRowXpr>(derived(),i);
|
||||
}
|
||||
|
||||
/** \returns the number of subvectors (rows or columns) in the direction \c Direction
|
||||
|
||||
@@ -13,20 +13,20 @@
|
||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||
|
||||
/** \internal the return type of conjugate() */
|
||||
typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
|
||||
const CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, const Derived>,
|
||||
const Derived&
|
||||
>::type ConjugateReturnType;
|
||||
typedef std::conditional_t<NumTraits<Scalar>::IsComplex,
|
||||
const CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, const Derived>,
|
||||
const Derived&
|
||||
> ConjugateReturnType;
|
||||
/** \internal the return type of real() const */
|
||||
typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
|
||||
const CwiseUnaryOp<internal::scalar_real_op<Scalar>, const Derived>,
|
||||
const Derived&
|
||||
>::type RealReturnType;
|
||||
typedef std::conditional_t<NumTraits<Scalar>::IsComplex,
|
||||
const CwiseUnaryOp<internal::scalar_real_op<Scalar>, const Derived>,
|
||||
const Derived&
|
||||
> RealReturnType;
|
||||
/** \internal the return type of real() */
|
||||
typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
|
||||
CwiseUnaryView<internal::scalar_real_ref_op<Scalar>, Derived>,
|
||||
Derived&
|
||||
>::type NonConstRealReturnType;
|
||||
typedef std::conditional_t<NumTraits<Scalar>::IsComplex,
|
||||
CwiseUnaryView<internal::scalar_real_ref_op<Scalar>, Derived>,
|
||||
Derived&
|
||||
> NonConstRealReturnType;
|
||||
/** \internal the return type of imag() const */
|
||||
typedef CwiseUnaryOp<internal::scalar_imag_op<Scalar>, const Derived> ImagReturnType;
|
||||
/** \internal the return type of imag() */
|
||||
@@ -83,10 +83,10 @@ EIGEN_DOC_UNARY_ADDONS(conjugate,complex conjugate)
|
||||
/// \sa conjugate()
|
||||
template<bool Cond>
|
||||
EIGEN_DEVICE_FUNC
|
||||
inline typename internal::conditional<Cond,ConjugateReturnType,const Derived&>::type
|
||||
inline std::conditional_t<Cond,ConjugateReturnType,const Derived&>
|
||||
conjugateIf() const
|
||||
{
|
||||
typedef typename internal::conditional<Cond,ConjugateReturnType,const Derived&>::type ReturnType;
|
||||
typedef std::conditional_t<Cond,ConjugateReturnType,const Derived&> ReturnType;
|
||||
return ReturnType(derived());
|
||||
}
|
||||
|
||||
|
||||
@@ -67,9 +67,9 @@ struct EIGEN_INDEXED_VIEW_METHOD_TYPE {
|
||||
// This is the generic version
|
||||
|
||||
template<typename RowIndices, typename ColIndices>
|
||||
typename internal::enable_if<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
|
||||
std::enable_if_t<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
|
||||
&& internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::ReturnAsIndexedView,
|
||||
typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type >::type
|
||||
typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>
|
||||
operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
{
|
||||
return typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type
|
||||
@@ -79,9 +79,9 @@ operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_IND
|
||||
// The following overload returns a Block<> object
|
||||
|
||||
template<typename RowIndices, typename ColIndices>
|
||||
typename internal::enable_if<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
|
||||
std::enable_if_t<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
|
||||
&& internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::ReturnAsBlock,
|
||||
typename internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::BlockType>::type
|
||||
typename internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::BlockType>
|
||||
operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
{
|
||||
typedef typename internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::BlockType BlockType;
|
||||
@@ -97,9 +97,9 @@ operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_IND
|
||||
// The following overload returns a Scalar
|
||||
|
||||
template<typename RowIndices, typename ColIndices>
|
||||
typename internal::enable_if<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
|
||||
std::enable_if_t<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
|
||||
&& internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::ReturnAsScalar,
|
||||
CoeffReturnType >::type
|
||||
CoeffReturnType >
|
||||
operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
{
|
||||
return Base::operator()(internal::eval_expr_given_size(rowIndices,rows()),internal::eval_expr_given_size(colIndices,cols()));
|
||||
@@ -135,9 +135,9 @@ operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndicesT (&col
|
||||
// Overloads for 1D vectors/arrays
|
||||
|
||||
template<typename Indices>
|
||||
typename internal::enable_if<
|
||||
std::enable_if_t<
|
||||
IsRowMajor && (!(internal::get_compile_time_incr<typename IvcType<Indices>::type>::value==1 || internal::is_valid_index_type<Indices>::value)),
|
||||
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,typename IvcType<Indices>::type> >::type
|
||||
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,typename IvcType<Indices>::type> >
|
||||
operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||
@@ -146,9 +146,9 @@ operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
}
|
||||
|
||||
template<typename Indices>
|
||||
typename internal::enable_if<
|
||||
std::enable_if_t<
|
||||
(!IsRowMajor) && (!(internal::get_compile_time_incr<typename IvcType<Indices>::type>::value==1 || internal::is_valid_index_type<Indices>::value)),
|
||||
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,typename IvcType<Indices>::type,IvcIndex> >::type
|
||||
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,typename IvcType<Indices>::type,IvcIndex> >
|
||||
operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||
@@ -157,9 +157,9 @@ operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
}
|
||||
|
||||
template<typename Indices>
|
||||
typename internal::enable_if<
|
||||
std::enable_if_t<
|
||||
(internal::get_compile_time_incr<typename IvcType<Indices>::type>::value==1) && (!internal::is_valid_index_type<Indices>::value) && (!symbolic::is_symbolic<Indices>::value),
|
||||
VectorBlock<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,internal::array_size<Indices>::value> >::type
|
||||
VectorBlock<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,internal::array_size<Indices>::value> >
|
||||
operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||
@@ -169,15 +169,15 @@ operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
}
|
||||
|
||||
template<typename IndexType>
|
||||
typename internal::enable_if<symbolic::is_symbolic<IndexType>::value, CoeffReturnType >::type
|
||||
std::enable_if_t<symbolic::is_symbolic<IndexType>::value, CoeffReturnType >
|
||||
operator()(const IndexType& id) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
{
|
||||
return Base::operator()(internal::eval_expr_given_size(id,size()));
|
||||
}
|
||||
|
||||
template<typename IndicesT, std::size_t IndicesN>
|
||||
typename internal::enable_if<IsRowMajor,
|
||||
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,const IndicesT (&)[IndicesN]> >::type
|
||||
std::enable_if_t<IsRowMajor,
|
||||
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,const IndicesT (&)[IndicesN]> >
|
||||
operator()(const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||
@@ -186,8 +186,8 @@ operator()(const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
}
|
||||
|
||||
template<typename IndicesT, std::size_t IndicesN>
|
||||
typename internal::enable_if<!IsRowMajor,
|
||||
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const IndicesT (&)[IndicesN],IvcIndex> >::type
|
||||
std::enable_if_t<!IsRowMajor,
|
||||
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const IndicesT (&)[IndicesN],IvcIndex> >
|
||||
operator()(const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||
|
||||
Reference in New Issue
Block a user