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

5.7 KiB
Raw Permalink Blame History

[mdspan.extents.cons]

23 Containers library [containers]

23.7 Views [views]

23.7.3 Multidimensional access [views.multidim]

23.7.3.3 Class template extents [mdspan.extents]

23.7.3.3.3 Constructors [mdspan.extents.cons]

🔗

template<class OtherIndexType, size_t... OtherExtents> constexpr explicit(see below) extents(const extents<OtherIndexType, OtherExtents...>& other) noexcept;

1

#

Constraints:

  • (1.1)

    sizeof...(OtherExtents) == rank() is true.

  • (1.2)

    ((OtherExtents == dynamic_extent || Extents == dynamic_extent || OtherExtents ==
    Extents) && ...) is true.

2

#

Preconditions:

other.extent(r) equals Er for each r for which Er is a static extent, and

either

sizeof...(OtherExtents) is zero, or

other.extent(r) is representable as a value of type index_type for every rank index r of other.

3

#

Postconditions: *this == other is true.

4

#

Remarks: The expression inside explicit is equivalent to:(((Extents != dynamic_extent) && (OtherExtents == dynamic_extent)) || ... ) ||(numeric_limits<index_type>::max() < numeric_limits::max())

🔗

template<class... OtherIndexTypes> constexpr explicit extents(OtherIndexTypes... exts) noexcept;

5

#

Let N be sizeof...(OtherIndexTypes), and let exts_arr bearray<index_type, N>{static_cast<
index_type>(std::move(exts))...}.

6

#

Constraints:

(is_convertible_v<OtherIndexTypes, index_type> && ...) is true,

(is_nothrow_constructible_v<index_type, OtherIndexTypes> && ...) is true, and

N == rank_dynamic() || N == rank() is true. [Note 1: One can construct extents from just dynamic extents, which are all the values getting stored, or from all the extents with a precondition. — end note]

7

#

Preconditions:

If N != rank_dynamic() is true,exts_arr[r] equals Er for each r for which Er is a static extent, and

either

sizeof...(exts) == 0 is true, or

each element of exts is representable as a nonnegative value of type index_type.

8

#

Postconditions: *this == extents(exts_arr) is true.

🔗

template<class OtherIndexType, size_t N> constexpr explicit(N != rank_dynamic()) extents(span<OtherIndexType, N> exts) noexcept; template<class OtherIndexType, size_t N> constexpr explicit(N != rank_dynamic()) extents(const array<OtherIndexType, N>& exts) noexcept;

9

#

Constraints:

is_convertible_v<const OtherIndexType&, index_type> is true,

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

N == rank_dynamic() || N == rank() is true.

10

#

Preconditions:

If N != rank_dynamic() is true,exts[r] equals Er for each r for which Er is a static extent, and

either

N is zero, or

exts[r] is representable as a nonnegative value of type index_type for every rank index r.

11

#

Effects:

  • (11.1)

    If N equals rank_dynamic(), for all d in the range [0, rank_dynamic()), direct-non-list-initializes dynamic-extents[d] with as_const(exts[d]).

  • (11.2)

    Otherwise, for all d in the range [0, rank_dynamic()), direct-non-list-initializes dynamic-extents[d] with as_const(exts[dynamic-index-inv(d)]).

🔗

template<class... Integrals> explicit extents(Integrals...) -> see below;

12

#

Constraints: (is_convertible_v<Integrals, size_t> && ...) is true.

13

#

Remarks: The deduced type is extents<size_t, maybe-static-ext...>.