Despite @ Jarod42's good answer , here is another possible decltype based decltype that does not use tuple_size .
This follows a minimal working example that works in C ++ 11:
#include<array> struct Foo { std::array<int, 8> bar; }; int main() { constexpr std::size_t N = decltype(Foo::bar){}.size(); static_assert(N == 8, "!"); }
std::array already has a constexpr member function called size , which returns the value you are looking for.
skypjack Dec 27 '16 at 13:16 2016-12-27 13:16
source share