std::extents<IndexType,Extents...>:: rank
From cppreference.net
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::mdspan
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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)
|
获取数组类型的维度数量
(类模板) |