24 Containers library [containers]

24.7 Views [views]

24.7.3 Multidimensional access [views.multidim]

24.7.3.7 submdspan [mdspan.sub]

24.7.3.7.5 submdspan_extents function [mdspan.sub.extents]

template<class IndexType, class... Extents, class... SliceSpecifiers> constexpr auto submdspan_extents(const extents<IndexType, Extents...>& src, SliceSpecifiers... slices);
Constraints: sizeof...(slices) equals Extents​::​rank().
Mandates: For each rank index k of src.extents(), exactly one of the following is true:
Preconditions: For each rank index k of src.extents(), all of the following are true:
  • if is a specialization of strided_slice
  • 0  ≤ first_<IndexType, k>(slices...)  ≤ last_<k>(src, slices...)  ≤ src.extent(k)
Let SubExtents be a specialization of extents such that:
  • SubExtents​::​rank() equals the number of k such that does not model convertible_to<IndexType>; and
  • for each rank index k of Extents such that map-rank[k] != dynamic_extent is true, SubExtents​::​static_extent(map-rank[k]) equals:
    • Extents​::​static_extent(k) if is_convertible_v<, full_extent_t> is true; otherwise
    • de-ice(tuple_element_t<1, >()) - de-ice(tuple_element_t<0, >()) if models index-pair-like<IndexType>, and both tuple_element_t<0, > and tuple_element_t<1, > model integral-constant-like; otherwise
    • 0, if is a specialization of strided_slice, whose extent_type models integral-constant-like, for which extent_type() equals zero; otherwise
    • 1 + (de-ice(​::​extent_type()) - 1) / de-ice(​::​stride_type()), if is a specialization of strided_slice whose extent_type and stride_type model integral-constant-like;
    • otherwise, dynamic_extent.
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:
  • .extent == 0 ? 0 : 1 + (de-ice(.extent) - 1) / de-ice(.stride) if is a specialization of strided_slice,
  • otherwise, last_<k>(src, slices...) - first_<IndexType, k>(slices...).