[mdspan.sub.helpers]

# 23 Containers library [[containers]](./#containers)

## 23.7 Views [[views]](views#mdspan.sub.helpers)

### 23.7.3 Multidimensional access [[views.multidim]](views.multidim#mdspan.sub.helpers)

#### 23.7.3.7 submdspan [[mdspan.sub]](mdspan.sub#helpers)

#### 23.7.3.7.4 Exposition-only helpers [mdspan.sub.helpers]

[ð](#lib:de-ice)

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

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25378)

*Mandates*: IndexType is a signed or unsigned integer type[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25383)

Let Ïk denote the following value:

- [(2.1)](#2.1)

sk if Sk models [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<IndexType>;

- [(2.2)](#2.2)

otherwise,get<0>(sk) if Sk models [*index-pair-like*](mdspan.syn#concept:index-pair-like "23.7.3.2 Header <mdspan> synopsis [mdspan.syn]")<IndexType>;

- [(2.3)](#2.3)

otherwise,*de-ice*(sk.offset) if Sk is a specialization of strided_slice;

- [(2.4)](#2.4)

otherwise,0[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25401)

*Preconditions*: Ïk is representable as a value of type IndexType[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25405)

*Returns*: extents<IndexType>​::​*index-cast*(Ïk)[.](#4.sentence-1)

[ð](#lib:last_)

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

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25417)

*Mandates*: Extents is a specialization of extents[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25421)

Let index_type be typename Extents​::​index_type[.](#6.sentence-1)

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25425)

Let Î»k denote the following value:

- [(7.1)](#7.1)

*de-ice*(sk) + 1 if Sk models [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<index_type>; otherwise

- [(7.2)](#7.2)

get<1>(sk) if Sk models [*index-pair-like*](mdspan.syn#concept:index-pair-like "23.7.3.2 Header <mdspan> synopsis [mdspan.syn]")<index_type>; otherwise

- [(7.3)](#7.3)

*de-ice*(sk.offset) +*de-ice*(sk.extent) if Sk is a specialization of strided_slice; otherwise

- [(7.4)](#7.4)

src.extent(k)[.](#7.sentence-1)

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25443)

*Preconditions*: Î»k is representable as a value of type index_type[.](#8.sentence-1)

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25447)

*Returns*: Extents​::​*index-cast*(Î»k)[.](#9.sentence-1)

[ð](#lib:src-indices)

`template<class IndexType, size_t N, class... SliceSpecifiers>
  constexpr array<IndexType, sizeof...(SliceSpecifiers)>
    src-indices(const array<IndexType, N>& indices, SliceSpecifiers... slices);
`

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25460)

*Mandates*: IndexType is a signed or unsigned integer type[.](#10.sentence-1)

[11](#11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L25464)

*Returns*: An array<IndexType, sizeof...(SliceSpecifiers)> src_idx such that
for each k in the range [0, sizeof...(SliceSpecifiers)),src_idx[k] equals

- [(11.1)](#11.1)

*first_*<IndexType, k>(slices...) for each k where *map-rank*[k] equalsdynamic_extent,

- [(11.2)](#11.2)

otherwise,*first_*<IndexType, k>(slices...) +indices[*map-rank*[k]].
