std::extents
From cppreference.com
Defined in header <mdspan>
|
||
template<class IndexType, std::size_t... Extents> class extents; |
(since C++23) | |
The class template extents
represents a multidimensional index space of rank equal to sizeof...(Extents).
Each specialization of extents
models regular
and is TriviallyCopyable.
Contents |
[edit] Template parameters
IndexType | - | the type of each non-dynamic Extents . Shall be a signed or unsigned integer type. Otherwise, the program is ill-formed.
|
Extents | - | represents extent (size of an integer interval) for each rank index. Each element of it is either equal to std::dynamic_extent (in this case, it represents a dynamic extent and the extent size shall be determined dynamically), or is representable as a value of type IndexType (then it represents a static extent and the extent size is just the value of it), or else the program is ill-formed.
|
[edit] Member types
Member type | Definition |
index_type
|
IndexType
|
size_type
|
std::make_unsigned_t<index_type>
|
rank_type
|
std::size_t
|
[edit] Data members
Typical implementations only hold one non-static data member:
-
dynamic-extents
in type std::array<index_type, rank_dynamic()>, stores the size of each dynamic extents. The name is for exposition only.
-
[edit] Member functions
constructs an extents (public member function) | |
Observers | |
[static] |
returns the static rank of an extents (public static member function) |
[static] |
returns the dynamic rank of an extents (public static member function) |
[static] |
returns static extent size of an extents at a certain rank index (public static member function) |
returns dynamic extent size of an extents at a certain rank index (public member function) | |
Public exposition-only helpers | |
returns the product of extent size in range [ 0, i) . The name is for exposition only. (public member function) | |
returns the product of extents size in range [ i + 1, rank()) . The name is for exposition only. (public member function) | |
casts the input into an integer type. The name is for exposition only. (public member function) | |
Private exposition-only helpers | |
returns the number of dynamic extents below a certain rank index. The name is for exposition only. (private member function) | |
returns the number r that in range [ 0, r + 1) there is exactly i + 1 dynamic extents for a certain argument i . The name is for exposition only. (private member function) |
[edit] Non-member functions
compare underlying extents in each dimension of two extents (function) |