What does std::rank<int>::value return in C++?
Options
- B. 1
- C. The size of int
- D. More than one of the above
- E. None of the above
Quiz Practice:
Answer: (A) 0
std::rank returns the number of dimensions of an array type.
The type int is not an array type. Therefore, it has no array dimensions and std::rank<int>::value is 0.
For comparison, std::rank<int[5]>::value is 1, and a multidimensional array has a rank greater than 1.