名稱空間
變體
操作

std::extents<IndexType,Extents...>::rank

來自 cppreference.com
< cpp‎ | 容器‎ | mdspan‎ | extents
 
 
 
 
 
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) [編輯]