template <class T> struct rank;
123456789101112
// array rank example #include <iostream> #include <type_traits> int main() { std::cout << "rank:" << std::endl; std::cout << "int: " << std::rank<int>::value << std::endl; std::cout << "int[]: " << std::rank<int[]>::value << std::endl; std::cout << "int[][10]: " << std::rank<int[][10]>::value << std::endl; std::cout << "int[10][10]: " << std::rank<int[10][10]>::value << std::endl; return 0; }
rank: int: 0 int[]: 1 int[][10]: 2 int[10][10]: 2