std::extents<IndexType,Extents...>::rank
来自 cppreference.cn
static constexpr rank_type rank() const noexcept; |
(since C++23) | |
返回 extents 中的维度数量。
目录 |
[edit] 参数
(无)
[edit] 返回值
维度数量。
[edit] 示例
运行此代码
#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
[edit] 参见
[静态] |
返回 extents 的动态秩 (公共静态成员函数) |
(C++11) |
获取数组类型的维度数量 (类模板) |