Files
2025-10-25 03:02:53 +03:00

5.3 KiB
Raw Permalink Blame History

[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;

1

#

Preconditions: layout_right::mapping<extents_type>().required_span_size() is representable as a value of type index_type ([basic.fundamental]).

2

#

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;

3

#

Constraints:

is_convertible_v<const OtherIndexType&, index_type> is true, and

is_nothrow_constructible_v<index_type, const OtherIndexType&> is true.

4

#

Preconditions:

  • (4.1)

    The result of converting s[i] to index_type is greater than 0 for all i in the range [0, rank_).

  • (4.2)

    REQUIRED-SPAN-SIZE(e, s) is representable as a value of type index_type ([basic.fundamental]).

  • (4.3)

    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]

5

#

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;

6

#

Constraints:

  • (6.1)

    layout-mapping-alike is satisfied.

  • (6.2)

    is_constructible_v<extents_type, typename StridedLayoutMapping::extents_type> is
    true.

  • (6.3)

    StridedLayoutMapping::is_always_unique() is true.

  • (6.4)

    StridedLayoutMapping::is_always_strided() is true.

7

#

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.

8

#

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).

9

#

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>))