[mdspan.sub.helpers] (original) (raw)
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<class T> constexpr T _de-ice_(T val) { return val; } template<[_integral-constant-like_](span.syn#concept:integral-constant-like "23.7.2.1 Header <span> synopsis [span.syn]") 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 denote the following value:
- if models convertible_to<IndexType>;
- otherwise,get<0>()if models index-pair-like<IndexType>;
- otherwise,de-ice(.offset)if is a specialization of strided_slice;
- otherwise,0.
Preconditions: is representable as a value of type IndexType.
Returns: extents<IndexType>::index-cast().
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 denote the following value:
- de-ice() + 1if models convertible_to<index_type>; otherwise
- get<1>()if models index-pair-like<index_type>; otherwise
- de-ice(.offset) + de-ice(.extent)if is a specialization of strided_slice; otherwise
- src.extent(k).
Preconditions: is representable as a value of type index_type.
Returns: Extents::index-cast().
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 kwhere _map-rank_[k] equalsdynamic_extent,
- otherwise,first_<IndexType, k>(slices...) + indices[_map-rank_[k]].