std::extents<IndexType,Extents...>::rank
來自 cppreference.com
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 的動態秩(public static member function) |
(C++11) |
獲取陣列型別的維數 (class template) |