mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-15 05:05:58 +08:00
Revert "ensure that eigen::internal::size is not found by ADL, rename to ssize and..."
This reverts commit bd72e4a8c4f2bc41d3b4a87be7d5e850efaa461d
This commit is contained in:
parent
3e71c621c9
commit
4612627355
@ -122,10 +122,10 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
/** \returns number of rows */
|
/** \returns number of rows */
|
||||||
Index rows() const { return internal::index_list_size(m_rowIndices); }
|
Index rows() const { return internal::size(m_rowIndices); }
|
||||||
|
|
||||||
/** \returns number of columns */
|
/** \returns number of columns */
|
||||||
Index cols() const { return internal::index_list_size(m_colIndices); }
|
Index cols() const { return internal::size(m_colIndices); }
|
||||||
|
|
||||||
/** \returns the nested expression */
|
/** \returns the nested expression */
|
||||||
const typename internal::remove_all<XprType>::type&
|
const typename internal::remove_all<XprType>::type&
|
||||||
|
@ -466,33 +466,20 @@ template<typename T, std::size_t N> struct array_size<std::array<T,N> > {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/** \internal
|
/** \internal
|
||||||
* Analogue of the std::ssize free function.
|
* Analogue of the std::size free function.
|
||||||
* It returns the signed size of the container or view \a x of type \c T
|
* It returns the size of the container or view \a x of type \c T
|
||||||
*
|
*
|
||||||
* It currently supports:
|
* It currently supports:
|
||||||
* - any types T defining a member T::size() const
|
* - any types T defining a member T::size() const
|
||||||
* - plain C arrays as T[N]
|
* - plain C arrays as T[N]
|
||||||
*
|
*
|
||||||
* For C++20, this function just forwards to `std::ssize`, or any ADL discoverable `ssize` function.
|
|
||||||
*/
|
*/
|
||||||
#if EIGEN_COMP_CXXVER < 20
|
template<typename T>
|
||||||
template <typename T>
|
EIGEN_CONSTEXPR Index size(const T& x) { return x.size(); }
|
||||||
EIGEN_CONSTEXPR auto index_list_size(const T& x) {
|
|
||||||
using R = std::common_type_t<std::ptrdiff_t, std::make_signed_t<decltype(x.size())>>;
|
|
||||||
return static_cast<R>(x.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T, std::ptrdiff_t N>
|
template<typename T,std::size_t N>
|
||||||
EIGEN_CONSTEXPR std::ptrdiff_t index_list_size(const T (&)[N]) { return N; }
|
EIGEN_CONSTEXPR Index size(const T (&) [N]) { return N; }
|
||||||
#else
|
|
||||||
template <typename T>
|
|
||||||
EIGEN_CONSTEXPR auto index_list_size(T&& x) {
|
|
||||||
using std::ssize;
|
|
||||||
return ssize(std::forward<T>(x));
|
|
||||||
}
|
|
||||||
#endif // EIGEN_COMP_CXXVER
|
|
||||||
|
|
||||||
/** \internal
|
/** \internal
|
||||||
* Convenient struct to get the result type of a nullary, unary, binary, or
|
* Convenient struct to get the result type of a nullary, unary, binary, or
|
||||||
|
@ -90,8 +90,8 @@ operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_IND
|
|||||||
return BlockType(derived(),
|
return BlockType(derived(),
|
||||||
internal::first(actualRowIndices),
|
internal::first(actualRowIndices),
|
||||||
internal::first(actualColIndices),
|
internal::first(actualColIndices),
|
||||||
internal::index_list_size(actualRowIndices),
|
internal::size(actualRowIndices),
|
||||||
internal::index_list_size(actualColIndices));
|
internal::size(actualColIndices));
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following overload returns a Scalar
|
// The following overload returns a Scalar
|
||||||
@ -168,7 +168,7 @@ operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
|
|||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||||
typename IvcType<Indices>::type actualIndices = ivcSize(indices);
|
typename IvcType<Indices>::type actualIndices = ivcSize(indices);
|
||||||
return VectorBlock<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,internal::array_size<Indices>::value>
|
return VectorBlock<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,internal::array_size<Indices>::value>
|
||||||
(derived(), internal::first(actualIndices), internal::index_list_size(actualIndices));
|
(derived(), internal::first(actualIndices), internal::size(actualIndices));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename IndexType>
|
template<typename IndexType>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user