std::extents, std::dextents, std::dims
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Containers library
(C++17)
(C++11)
(C++26)
(C++26)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++23)
(C++23)
(C++23)
(C++23)
(C++20)
(C++23)
Tables
std::mdspan
(C++26)
(C++26)
extentsdextents
dims
(C++26)
(C++26)
(C++26)
(C++26)
(C++26)
(C++26)
(C++26)
std::extents
Defined in header
<mdspan>
template< class IndexType, std::size_t... Extents >
class extents;
(1)
(since C++23)
class extents;
template< class IndexType, std::size_t Rank >
using dextents = /* see below */
(2)
(since C++23)
using dextents = /* see below */
template< std::size_t Rank, class IndexType = std::size_t >
using dims = std::dextents<IndexType, Rank>;
(3)
(since C++26)
using dims = std::dextents<IndexType, Rank>;
1) Represents a multidimensional index space of rank equal to sizeof...(Extents).
2) A convenient alias template for an all-dynamic
extents
. Let d
denote std::dynamic_extent , each specialization of it dextents<IndexType, Rank> is equivalent to extents<IndexType /*, d, d, ..., d*/> (i.e. d
is repeated a total of Rank
times).3) A convenient alias template for an all-dynamic
extents
with std::size_t as the default index type.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 will 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
Rank
-
denotes the rank of an all-dynamic
extents
[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
Member name
Definition
std::array <index_type, rank_dynamic()>
(exposition-only member object*)
dynamic-extents
(private)
An array which stores the size of each dynamic extents.(exposition-only member object*)
[edit] Member functions
Observers
[static]
extents
at a certain rank index (public static member function) [edit]
Helpers
returns the product of extents size in range
(exposition-only member function*)[edit]
[
i + 1,
rank())
(exposition-only member function*)[edit]
(private)
(exposition-only member function*)[edit]
(private)
r
such that in range [
0,
r + 1)
there is exactly i + 1
dynamic extents for a certain argument i
(exposition-only member function*)[edit]
[edit] Non-member functions
[edit] Deduction guides (C++23)
[edit] Example
This section is incomplete
Reason: no example
Reason: no example