Add convenience method constexpr std::size_t size() const to Eigen::IndexList

This commit is contained in:
Rasmus Munk Larsen
2022-02-12 04:23:03 +00:00
committed by Antonio Sánchez
parent fbc62f7df9
commit 18eab8f997
2 changed files with 7 additions and 0 deletions

View File

@@ -305,6 +305,11 @@ struct IndexList : internal::IndexTuple<FirstType, OtherTypes...> {
return internal::tuple_coeff<internal::array_size<internal::IndexTuple<FirstType, OtherTypes...> >::value-1, Index>::set(i, *this, value);
}
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr std::size_t size() const {
return 1 + sizeof...(OtherTypes);
};
EIGEN_DEVICE_FUNC constexpr IndexList(const internal::IndexTuple<FirstType, OtherTypes...>& other) : internal::IndexTuple<FirstType, OtherTypes...>(other) { }
EIGEN_DEVICE_FUNC constexpr IndexList(FirstType& first, OtherTypes... other) : internal::IndexTuple<FirstType, OtherTypes...>(first, other...) { }
EIGEN_DEVICE_FUNC constexpr IndexList() : internal::IndexTuple<FirstType, OtherTypes...>() { }