std::extents<IndexType,Extents...>:: static_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::static_extent
|
||||
| Helpers | ||||
| Non-member functions | ||||
| Deduction guides |
|
static
constexpr
std::
size_t
static_extent
(
rank_type i
)
noexcept
;
|
(C++23以降) | |
extents
のランクインデックス
i
における静的エクステントサイズを返します。ランクインデックス
i
が動的エクステントの場合、
std::dynamic_extent
を返します。
目次 |
パラメータ
| i | - | 静的エクステントサイズを取得するランクインデックス |
戻り値
静的エクステントサイズまたは std::dynamic_extent の値。
例
このコードを実行
#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.static_extent(0) << ", " << e1.static_extent(1) << '\n'; std::cout << (e2.static_extent(0) == std::dynamic_extent) << ", " << (e2.static_extent(1) == std::dynamic_extent) << ", " << (e2.static_extent(2) == std::dynamic_extent) << '\n'; }
出力:
1, 2 0, 1, 1
関連項目
指定されたランクインデックスにおける
extents
の動的エクステントサイズを返す
(公開メンバ関数) |
|
|
(C++11)
|
指定された次元における配列型のサイズを取得する
(クラステンプレート) |