如何在不创建其实例的情况下获取 std::array<T, N> 中的元素数?

How to get the number of elements in std::array<T, N> without having to create its instance?

std::array<T, N>::size(),但它是非静态的,因此需要 std::array 的实例。有没有办法在不必构造数组实例的情况下获取它的值 returns(即 std::array<T, N>N)?对于普通数组,我可以使用 sizeof,但我看不出 sizeof(std::array<T, N>) == N * sizeof(T) 是真的。

std::tuple_size<std::array>.

static_assert(std::tuple_size<std::array<int, 5>>::value == 5);