Change array_size result from enum to constexpr.

This commit is contained in:
Antonio Sánchez 2024-02-22 22:52:25 +00:00 committed by Rasmus Munk Larsen
parent 8a73c6490f
commit feaafda30a
2 changed files with 10 additions and 10 deletions

View File

@ -204,19 +204,19 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T& array_get(const array<T, N>& a) {
template <class T, std::size_t N>
struct array_size<array<T, N> > {
enum { value = N };
static constexpr Index value = N;
};
template <class T, std::size_t N>
struct array_size<array<T, N>&> {
enum { value = N };
static constexpr Index value = N;
};
template <class T, std::size_t N>
struct array_size<const array<T, N> > {
enum { value = N };
static constexpr Index value = N;
};
template <class T, std::size_t N>
struct array_size<const array<T, N>&> {
enum { value = N };
static constexpr Index value = N;
};
} // end namespace internal

View File

@ -303,30 +303,30 @@ class noncopyable {
*/
template <typename T, typename EnableIf = void>
struct array_size {
enum { value = Dynamic };
static constexpr Index value = Dynamic;
};
template <typename T>
struct array_size<T, std::enable_if_t<((T::SizeAtCompileTime & 0) == 0)>> {
enum { value = T::SizeAtCompileTime };
static constexpr Index value = T::SizeAtCompileTime;
};
template <typename T, int N>
struct array_size<const T (&)[N]> {
enum { value = N };
static constexpr Index value = N;
};
template <typename T, int N>
struct array_size<T (&)[N]> {
enum { value = N };
static constexpr Index value = N;
};
template <typename T, std::size_t N>
struct array_size<const std::array<T, N>> {
enum { value = N };
static constexpr Index value = N;
};
template <typename T, std::size_t N>
struct array_size<std::array<T, N>> {
enum { value = N };
static constexpr Index value = N;
};
/** \internal