24 Containers library [containers]

24.7 Views [views]

24.7.3 Multidimensional access [views.multidim]

24.7.3.4 Layout mapping [mdspan.layout]

24.7.3.4.7 Class template layout_stride​::​mapping [mdspan.layout.stride]

24.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] with layout_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:
  • s[i] > 0 is true 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[] >= s[] * e.extent(p) is true for all i in the range [1, rank_), where is the 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<StridedLayoutMapping> 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:
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, LayoutStrideMapping> || is-mapping-of<layout_right, LayoutStrideMapping> || is-mapping-of<layout_stride, LayoutStrideMapping>))