std::extents<IndexType,Extents...>:: extent
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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::extents
| Member functions | ||||
| Observers | ||||
|
extents::extent
|
||||
| Helpers | ||||
| Non-member functions | ||||
| Deduction guides |
|
constexpr
index_type extent
(
rank_type i
)
const
noexcept
;
|
(C++23 起) | |
返回
extents
在指定秩索引处的动态范围大小。
目录 |
参数
| i | - | 要获取其范围大小的秩索引 |
返回值
extents
在特定秩索引处的动态范围大小。
示例
运行此代码
#include <iostream> #include <mdspan> int main() { std::extents<int, 1, 2> e1; std::extents<int, 3, std::dynamic_extent, std::dynamic_extent> e2(4, 5); std::cout << e1.extent(0) << ", " << e1.extent(1) << '\n'; std::cout << e2.extent(0) << ", " << e2.extent(1) << ", " << e2.extent(2) << '\n'; }
输出:
1, 2 3, 4, 5
参见
|
[static]
|
返回
extents
在指定秩索引处的静态范围大小
(公开静态成员函数) |
|
(C++11)
|
获取数组类型在指定维度上的大小
(类模板) |