On this page
std::extents<IndexType,Extents...>::extents
|
(1) | (since C++23) |
|
(2) | (since C++23) |
|
(3) | (since C++23) |
|
(4) | (since C++23) |
|
(5) | (since C++23) |
Construct an extents. One can construct extents from just dynamic extents, which are all the values getting stored, or from all the extents with a precondition.
1) Default constructor. Initializes all dynamic extents to zero.
2) Conversion from another extents object. After construction, *this == other is true.
- The behavior is undefined if
other.extent(r) != static_extent(r)for anyrfor whichstatic_extent(r)represents a static extent, orother.extent(r)is not representable as a value of typeIndexTypefor any rank valuerinother.- This overload participates in overload resolution only if
sizeof...(OtherExtents) == rank()is true, and((OtherExtents == std::dynamic_extent || Extents == std::dynamic_extent ||is true.
OtherExtents == Extents) && ...)- This constructor is explicit if
((Extents != std::dynamic_extent && OtherExtents == std::dynamic_extent) || ...)is true, orstd::numeric_limits<IndexType>::max() < std::numeric_limits<OtherIndexType>::max()is true.
N be sizeof...(exts) and exts_arr be std::array<IndexType, N>{static_cast<IndexType>(std::move(exts))...}, equivalent to extents(exts_arr).
- This overload participates in overload resolution only if
(std::is_convertible_v<OtherIndexTypes, IndexType> && ...)is true,(std::is_nothrow_constructible_v<IndexType, OtherIndexTypes> && ...)is true, andN == rank_dynamic() || N == rank()is true.- The behavior is undefined if
N != rank_dynamic()andexts_arr[r]is not equal tostatic_extent(r)for anyrfor whichstatic_extent(r)represents a static extent, or- an element in
extsis negative or not representable as a value of typeIndexType.
N equals rank_dynamic(), for all d in [0, rank_dynamic()), direct-non-list-initializes dynamic-extents[d] with std::as_const(exts[d]). Otherwise, for all d in [0, rank_dynamic()), direct-non-list-initializes dynamic-extents[d] with std::as_const(exts[dynamic-index-inv(d)]).
- This overload participates in overload resolution only if
(std::is_convertible_v<const OtherIndexType&, IndexType> && ...)is true,(std::is_nothrow_constructible_v<IndexType, const OtherIndexType&> && ...)is true, andN == rank_dynamic() || N == rank()is true.- The behavior is undefined if
N != rank_dynamic()andexts[r]is not equal tostatic_extent(r)for anyrfor whichstatic_extent(r)represents a static extent, orexts[r]is negative or not representable as a value of typeIndexTypefor any rank indexr.
Parameters
| other | - | another extents to convert from |
| exts | - | represents the extents |
Example
See also
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/container/mdspan/extents/extents