5.3 KiB
[mdspan.layout.stride.cons]
23 Containers library [containers]
23.7 Views [views]
23.7.3 Multidimensional access [views.multidim]
23.7.3.4 Layout mapping [mdspan.layout]
23.7.3.4.7 Class template layout_stride::mapping [mdspan.layout.stride]
23.7.3.4.7.3 Constructors [mdspan.layout.stride.cons]
constexpr mapping() noexcept;
Preconditions: layout_right::mapping<extents_type>().required_span_size() is representable as a value of type index_type ([basic.fundamental]).
Effects: Direct-non-list-initializes extents_ with extents_type(), and for all d in the range [0, rank_), direct-non-list-initializes strides_[d] withlayout_right::mapping<extents_type>().stride(d).
template<class OtherIndexType> constexpr mapping(const extents_type& e, span<OtherIndexType, rank_> s) noexcept; template<class OtherIndexType> constexpr mapping(const extents_type& e, const array<OtherIndexType, rank_>& s) noexcept;
Constraints:
is_convertible_v<const OtherIndexType&, index_type> is true, and
is_nothrow_constructible_v<index_type, const OtherIndexType&> is true.
Preconditions:
-
The result of converting s[i] to index_type is greater than 0 for all i in the range [0, rank_).
-
REQUIRED-SPAN-SIZE(e, s) is representable as a value of type index_type ([basic.fundamental]).
-
If rank_ is greater than 0, then there exists a permutation P of the integers in the range [0, rank_), such that s[pi] >= s[piâ1] * e.extent(piâ1) is true for all i in the range [1, rank_), where pi is the ith element of P. [Note 1: For layout_stride, this condition is necessary and sufficient for is_unique() to be true. â end note]
Effects: Direct-non-list-initializes extents_ with e, and for all d in the range [0, rank_), direct-non-list-initializes strides_[d] with as_const(s[d]).
template<class StridedLayoutMapping> constexpr explicit(see below) mapping(const StridedLayoutMapping& other) noexcept;
Constraints:
-
layout-mapping-alike is satisfied.
-
is_constructible_v<extents_type, typename StridedLayoutMapping::extents_type> is
true. -
StridedLayoutMapping::is_always_unique() is true.
-
StridedLayoutMapping::is_always_strided() is true.
Preconditions:
StridedLayoutMapping meets the layout mapping requirements ([mdspan.layout.reqmts]),
other.stride(r) > 0 is true for every rank index r of extents(),
other.required_span_size() is representable as a value of type index_type ([basic.fundamental]), and
OFFSET(other) == 0 is true.
Effects: Direct-non-list-initializes extents_ with other.extents(), and for all d in the range [0, rank_), direct-non-list-initializes strides_[d] with other.stride(d).
Remarks: The expression inside explicit is equivalent to:!(is_convertible_v<typename StridedLayoutMapping::extents_type, extents_type> &&(is-mapping-of<layout_left, StridedLayoutMapping> ||is-mapping-of<layout_right, StridedLayoutMapping> ||is-layout-left-padded-mapping-of ||is-layout-right-padded-mapping-of ||is-mapping-of<layout_stride, StridedLayoutMapping>))