std::extents<IndexType,Extents...>::extent
來自 cppreference.com
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
[編輯] 參閱
[靜態] |
返回特定等級索引處 extents 的靜態範圍大小(public static 成員函式) |
(C++11) |
獲取陣列型別在指定維度上的大小 (類模板) |