std::extents<IndexType,Extents...>::rank
static constexpr rank_type rank() const noexcept;
|
(C++23 起) | |
返回 extents
中维度的数量。
参数
(无)
返回值
维度的数量。
示例
#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'; }
输出:
2, 3
参阅
[静态]
|
返回 extents 的动态秩(公开静态成员函数) |
(C++11)
|
获取数组类型的维数 (类模板) |