Files
2025-10-25 03:02:53 +03:00

4.4 KiB
Raw Permalink Blame History

[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); `

1

#

Mandates: IndexType is a signed or unsigned integer type.

2

#

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.

3

#

Preconditions: ϕk is representable as a value of type IndexType.

4

#

Returns: extents::index-cast•k).

🔗

template<size_t k, class Extents, class... SliceSpecifiers> constexpr auto last_(const Extents& src, SliceSpecifiers... slices);

5

#

Mandates: Extents is a specialization of extents.

6

#

Let index_type be typename Extents::index_type.

7

#

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).

8

#

Preconditions: λk is representable as a value of type index_type.

9

#

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);

10

#

Mandates: IndexType is a signed or unsigned integer type.

11

#

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]].