dragonroot :
There is std::array<T, N>::size()
, but it's non-static, so it requires an instance of std::array
. Is there a way to get the value it returns (which is the N
of std::array<T, N>
) without having to construct an instance of the array? For a normal array, I could have used sizeof
, but I see no guarantee that sizeof(std::array<T, N>) == N * sizeof(T)
be true.
0x499602D2 :
There's std::tuple_size<std::array>
.
static_assert(std::tuple_size<std::array<int, 5>>::value == 5);
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=368334&siteId=1