[mdspan.mdspan.cons] (original) (raw)

23 Containers library [containers]

23.7 Views [views]

23.7.3 Multidimensional access [views.multidim]

23.7.3.6 Class template mdspan [mdspan.mdspan]

23.7.3.6.2 Constructors [mdspan.mdspan.cons]

Constraints:

Preconditions: [0, _map__.required_span_size()) is an accessible range of _ptr__ and _acc__for the values of _map__ and _acc__after the invocation of this constructor.

Effects: Value-initializes ptr_, map_, and acc_.

template<class... OtherIndexTypes> constexpr explicit mdspan(data_handle_type p, OtherIndexTypes... exts);

Let N be sizeof...(OtherIndexTypes).

Constraints:

Preconditions: [0, _map__.required_span_size()) is an accessible range of p and _acc__for the values of _map__ and _acc__after the invocation of this constructor.

Effects:

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

Constraints:

Preconditions: [0, _map__.required_span_size()) is an accessible range of p and _acc__for the values of _map__ and _acc__after the invocation of this constructor.

Effects:

constexpr mdspan(data_handle_type p, const extents_type& ext);

Constraints:

Preconditions: [0, _map__.required_span_size()) is an accessible range of p and _acc__for the values of _map__ and _acc__after the invocation of this constructor.

Effects:

constexpr mdspan(data_handle_type p, const mapping_type& m);

Constraints: is_default_constructible_v<accessor_type> is true.

Preconditions: [0, m.required_span_size()) is an accessible range of p and _acc__for the value of _acc__ after the invocation of this constructor.

Effects:

constexpr mdspan(data_handle_type p, const mapping_type& m, const accessor_type& a);

Preconditions: [0, m.required_span_size()) is an accessible range of p and a.

Effects:

template<class OtherElementType, class OtherExtents,class OtherLayoutPolicy, class OtherAccessor> constexpr explicit(_see below_) mdspan(const mdspan<OtherElementType, OtherExtents, OtherLayoutPolicy, OtherAccessor>& other);

Constraints:

Mandates:

Preconditions: [0, _map__.required_span_size()) is an accessible range of _ptr__ and _acc__for values of _ptr__, _map__, and _acc__after the invocation of this constructor.

Hardened preconditions: For each rank index r of extents_type,static_extent(r) == dynamic_extent || static_extent(r) == other.extent(r)is true.

Effects:

Remarks: The expression inside explicit is equivalent to:!is_convertible_v<const OtherLayoutPolicy::template mapping<OtherExtents>&, mapping_type> || !is_convertible_v<const OtherAccessor&, accessor_type>