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

template<class IndexType, size_t... Extents, class... SliceSpecifiers> constexpr auto submdspan_extents(const extents<IndexType, Extents...>& src, SliceSpecifiers... raw_slices);
Let slices be the pack introduced by the following declaration: auto [...slices] = submdspan_canonicalize_slices(src, raw_slices...);
Constraints: sizeof...(SliceSpecifiers) equals sizeof...(Extents).
Mandates: For each rank index k of src:
  • SliceSpecifiers...[k] is a submdspan slice type for IndexType, and
  • decltype(slices...[k]) is a valid submdspan slice type for the extent of extents<​IndexType, Extents...>.
Preconditions: For each rank index k of src, slices...[k] is a valid submdspan slice for the extent of src.
Let SubExtents be a specialization of extents such that:
  • SubExtents​::​rank() equals MAP_RANK(slices, Extents​::​rank()); and
  • for each rank index k of Extents such that the type of slices...[k] is not a collapsing slice type, SubExtents​::​static_extent(MAP_RANK(slices, k)) equals the following, where denotes the type of slices...[k]:
    • Extents​::​static_extent(k) if denotes the full_extent_t; otherwise
    • 0, if is a specialization of strided_slice and ​::​extent_type denotes constant_wrapper<IndexType(0)>; otherwise
    • 1 + ((​::​extent_type​::​value - 1) / ​::​stride_type​::​value), if is a specialization of strided_slice whose extent_type and stride_type denote specializations of constant_wrapper;
    • otherwise, dynamic_extent.
Returns: A value ext of type SubExtents such that for each rank index k of extents<IndexType, Extents...>, where the type of slices...[k] is not a collapsing slice type, ext.extent(MAP_RANK(slices, k)) equals the following, where denotes slices...[k]:
  • .extent == 0 ? 0 : 1 + (.extent - 1) / .stride if the type of is a specialization of strided_slice,
  • otherwise, , where [L, U) is the submdspan slice range of for the extent of src.