24 Containers library [containers]

24.7 Views [views]

24.7.3 Multidimensional access [views.multidim]

24.7.3.7 submdspan [mdspan.submdspan]

24.7.3.7.6 Layout specializations of submdspan_mapping [mdspan.submdspan.mapping]

template<class Extents> template<class... SliceSpecifiers> constexpr auto layout_left::mapping<Extents>::submdspan-mapping-impl( // exposition only SliceSpecifiers... slices) const -> see below; template<class Extents> template<class... SliceSpecifiers> constexpr auto layout_right::mapping<Extents>::submdspan-mapping-impl( // exposition only SliceSpecifiers... slices) const -> see below; template<class Extents> template<class... SliceSpecifiers> constexpr auto layout_stride::mapping<Extents>::submdspan-mapping-impl( // exposition only SliceSpecifiers... slices) const -> see below;
Let index_type be typename Extents​::​index_type.
Constraints: sizeof...(slices) equals Extents​::​rank().
Mandates: For each rank index k of extents(), exactly one of the following is true:
Preconditions: For each rank index k of extents(), all of the following are true:
  • if is a specialization of strided_slice
  • 0  ≤ first_<index_type, k>(slices...)
    0  ≤ last_<k>(extents(), slices...)
    0  ≤ extents().extent(k)
Let sub_ext be the result of submdspan_extents(extents(), slices...) and let SubExtents be decltype(sub_ext).
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(.stride) if is a specialization of strided_slice and .stride < .extent;
  • otherwise, stride(k).
Let P be a parameter pack such that is_same_v<make_index_sequence<rank()>, index_sequence<
P...>>
is true.
Let offset be a value of type size_t equal to (*this)(first_<index_type, P>(slices...)...).
Returns:
  • submdspan_mapping_result{*this, 0}, if Extents​::​rank() == 0 is true;
  • otherwise, submdspan_mapping_result{layout_left​::​mapping(sub_ext), offset}, if
    • layout_type is layout_left; and
    • for each k in the range [0, SubExtents​::​rank() - 1)), is_convertible_v<, full_extent_t> is true; and
    • for k equal to SubExtents​::​rank() - 1, models index-pair-like<index_type> or is_convertible_v<, full_extent_t> is true;
    [Note 1: 
    If the above conditions are true, all with k larger than SubExtents​::​rank() - 1 are convertible to index_type.
    — end note]
  • otherwise, submdspan_mapping_result{layout_right​::​mapping(sub_ext), offset}, if
    • layout_type is layout_right; and
    • for each k in the range [Extents​::​rank() - SubExtents​::​rank() + 1, Extents​::​rank()), is_convertible_v<, full_extent_t> is true; and
    • for k equal to Extents​::​rank() - SubExtents​::​rank(), models index-pair-like<index_type> or is_convertible_v<, full_extent_t> is true;
    [Note 2: 
    If the above conditions are true, all with are convertible to index_type.
    — end note]
  • otherwise, submdspan_mapping_result{layout_stride​::​mapping(sub_ext, sub_strides),
    offset}
    .