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

4.2 KiB
Raw Permalink Blame History

[mdspan.sub.map.common]

23 Containers library [containers]

23.7 Views [views]

23.7.3 Multidimensional access [views.multidim]

23.7.3.7 submdspan [mdspan.sub]

23.7.3.7.6 Specializations of submdspan_mapping [mdspan.sub.map]

23.7.3.7.6.1 Common [mdspan.sub.map.common]

1

#

The following elements apply to all functions in [mdspan.sub.map].

2

#

Constraints: sizeof...(slices) equals extents_type::rank().

3

#

Mandates: For each rank index k of extents(), exactly one of the following is true:

Sk models convertible_to<index_type>,

Sk models index-pair-like<index_type>,

is_convertible_v<Sk, full_extent_t> is true, or

Sk is a specialization of strided_slice.

4

#

Preconditions: For each rank index k of extents(), all of the following are true:

if Sk is a specialization of strided_slice,sk.extent is equal to zero orsk.stride is greater than zero; and

0 ≤ first_<index_type, k>(slices...)
0 ≤ last_(extents(), slices...)
0 ≤ extents().extent(k)

5

#

Let sub_ext be the result of submdspan_extents(extents(), slices...) and let SubExtents be decltype(sub_ext).

6

#

Let sub_strides be an array<SubExtents::index_type, SubExtents::rank()> such that for each rank index k of extents() for which map-rank[k] is not dynamic_extent,sub_strides[map-rank[k]] equals:

stride(k) * de-ice(sk.stride) if Sk is a specialization of strided_slice andsk.stride < sk.extent is true;

otherwise, stride(k).

7

#

Let P be a parameter pack such that is_same_v<make_index_sequence<rank()>, index_sequence<P...>> is true.

8

#

If first_<index_type, k>(slices...) equals extents().extent(k) for any rank index k of extents(), then let offset be a value of type size_t equal to(*this).required_span_size().

Otherwise, let offset be a value of type size_t equal to(*this)(first_<index_type, P>(slices...)...).

9

#

Given a layout mapping type M, a type S is aunit-stride slice for M if

S is a specialization of strided_slice where S::stride_type models integral-constant-like and S::stride_type::value equals 1,

S models index-pair-like<M::index_type>, or

is_convertible_v<S, full_extent_t> is true.