class template
<type_traits>
std::ranktemplate <class T> struct rank;
Array rank
The rank of an array type is its number of dimensions. For other types is zero.
The class is derived from integral_constant.
1
2
3
4
5
6
7
8
9
10
11
12
// 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4