static constexpr rank_type rank() const noexcept; | (since C++23) |
Returns the number of dimensions in extents
.
(none).
The number of dimensions.
#include <iostream> #include <mdspan> int main() { std::extents<int, 1, 2> e1; std::extents<int, 3, 4, std::dynamic_extent> e2(5); std::cout << e1.rank() << ", " << e2.rank() << '\n'; }
Output:
2, 3
[static] | returns the dynamic rank of an extents (public static member function) |
(C++11) | obtains the number of dimensions of an array type (class template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/container/mdspan/extents/rank