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;
Preconditions:
  • other.extent(r) equals
  • 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.
Remarks: The expression inside explicit is equivalent to: ((Extents != dynamic_extent) && (OtherExtents == dynamic_extent)) || .. ) || (numeric_limits<index_type>::max() < numeric_limits<OtherIndexType>::max()
template<class. OtherIndexTypes> constexpr explicit extents(OtherIndexTypes.. exts) noexcept;
Let N be sizeof.(OtherIndexTypes), and let exts_arr be array<index_type, N>{static_cast<
index_type>(std​::​move(exts)).}
.
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]
Preconditions:
  • If N != rank_dynamic() is true, exts_arr[r] equals
  • either
    • sizeof.(exts) == 0 is true, or
    • each element of exts is representable as a nonnegative value of type index_type.
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;
Preconditions:
  • If N != rank_dynamic() is true, exts[r] equals
  • either
    • N is zero, or
    • exts[r] is representable as a nonnegative value of type index_type for every rank index r.
Effects:
  • 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]).
  • 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;
Remarks: The deduced type is extents<size_t, maybe-static-ext<Integrals>.>.

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant