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

3.9 KiB
Raw Permalink Blame History

[mdspan.sub.extents]

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.5 submdspan_extents function [mdspan.sub.extents]

🔗

template<class IndexType, size_t... Extents, class... SliceSpecifiers> constexpr auto submdspan_extents(const extents<IndexType, Extents...>& src, SliceSpecifiers... slices);

1

#

Constraints: sizeof...(slices) equals sizeof...(Extents).

2

#

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

Sk models convertible_to,

Sk models index-pair-like,

is_convertible_v<Sk, full_extent_t> is true, or

Sk is a specialization of strided_slice.

3

#

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

if Sk is a specialization of strided_slice

sk.extent=0, or

sk.stride>0

0 ≤ first_<IndexType, k>(slices...) ≤ last_(src, slices...) ≤ src.extent(k)

4

#

Let SubExtents be a specialization of extents such that:

SubExtents::rank() equals the number of k such thatSk does not model convertible_to; and

for each rank index k of Extents such thatmap-rank[k] != dynamic_extent is true,SubExtents::static_extent(map-rank[k]) equals:

Extents::static_extent(k) if is_convertible_v<Sk, full_extent_t> is true; otherwise

de-ice(tuple_element_t<1, Sk>()) -de-ice(tuple_element_t<0, Sk>()) if Sk models index-pair-like, and both tuple_element_t<0, Sk> and tuple_element_t<1, Sk> model integral-constant-like; otherwise

0, if Sk is a specialization of strided_slice, whose extent_type models integral-constant-like, for which extent_type() equals zero; otherwise

1 + (de-ice(Sk::extent_type()) - 1) /de-ice(Sk::stride_type()), if Sk is a specialization of strided_slice whose extent_type and stride_type model integral-constant-like;

otherwise, dynamic_extent.

5

#

Returns: A value ext of type SubExtents such that for each k for which map-rank[k] != dynamic_extent is true,ext.extent(map-rank[k]) equals:

sk.extent == 0 ? 0 : 1 + (de-ice(sk.extent) - 1) / de-ice(sk.stride) if Sk is a specialization of strided_slice,

otherwise,last_(src, slices...) - first_<IndexType, k>(slices...).