4.4 KiB
[mdspan.sub.helpers]
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.4 Exposition-only helpers [mdspan.sub.helpers]
`template constexpr T de-ice(T val) { return val; } template<integral-constant-like T> constexpr auto de-ice(T) { return T::value; }
template<class IndexType, size_t k, class... SliceSpecifiers> constexpr IndexType first_(SliceSpecifiers... slices); `
Mandates: IndexType is a signed or unsigned integer type.
Let Ïk denote the following value:
sk if Sk models convertible_to;
otherwise,get<0>(sk) if Sk models index-pair-like;
otherwise,de-ice(sk.offset) if Sk is a specialization of strided_slice;
otherwise,0.
Preconditions: Ïk is representable as a value of type IndexType.
Returns: extents::index-cast(Ïk).
template<size_t k, class Extents, class... SliceSpecifiers> constexpr auto last_(const Extents& src, SliceSpecifiers... slices);
Mandates: Extents is a specialization of extents.
Let index_type be typename Extents::index_type.
Let λk denote the following value:
de-ice(sk) + 1 if Sk models convertible_to<index_type>; otherwise
get<1>(sk) if Sk models index-pair-like<index_type>; otherwise
de-ice(sk.offset) +de-ice(sk.extent) if Sk is a specialization of strided_slice; otherwise
src.extent(k).
Preconditions: λk is representable as a value of type index_type.
Returns: Extents::index-cast(λk).
template<class IndexType, size_t N, class... SliceSpecifiers> constexpr array<IndexType, sizeof...(SliceSpecifiers)> src-indices(const array<IndexType, N>& indices, SliceSpecifiers... slices);
Mandates: IndexType is a signed or unsigned integer type.
Returns: An array<IndexType, sizeof...(SliceSpecifiers)> src_idx such that for each k in the range [0, sizeof...(SliceSpecifiers)),src_idx[k] equals
first_<IndexType, k>(slices...) for each k where map-rank[k] equalsdynamic_extent,
otherwise,first_<IndexType, k>(slices...) +indices[map-rank[k]].