[mdspan.sub.map.common]

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

## 23.7 Views [[views]](views#mdspan.sub.map.common)

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

#### 23.7.3.7 submdspan [[mdspan.sub]](mdspan.sub#map.common)

#### 23.7.3.7.6 Specializations of submdspan_mapping [[mdspan.sub.map]](mdspan.sub.map#common)

#### 23.7.3.7.6.1 Common [mdspan.sub.map.common]

[1](#1)

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

The following elements apply to all functions in [[mdspan.sub.map]](mdspan.sub.map "23.7.3.7.6 Specializations of submdspan_­mapping")[.](#1.sentence-1)

[2](#2)

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

*Constraints*: sizeof...(slices) equals extents_type​::​rank()[.](#2.sentence-1)

[3](#3)

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

*Mandates*: For each rank index k of extents(),
exactly one of the following is true:

- [(3.1)](#3.1)

Sk models [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")<index_type>,

- [(3.2)](#3.2)

Sk models [*index-pair-like*](mdspan.syn#concept:index-pair-like "23.7.3.2 Header <mdspan> synopsis [mdspan.syn]")<index_type>,

- [(3.3)](#3.3)

is_convertible_v<Sk, full_extent_t> is true, or

- [(3.4)](#3.4)

Sk is a specialization of strided_slice[.](#3.sentence-1)

[4](#4)

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

*Preconditions*: For each rank index k of extents(),
all of the following are true:

- [(4.1)](#4.1)

if Sk is a specialization of strided_slice,sk.extent is equal to zero orsk.stride is greater than zero; and

- [(4.2)](#4.2)

0 â¤ *first_*<index_type, k>(slices...)   
0  â¤ *last_*<k>(extents(), slices...)   
0  â¤ extents().extent(k)

[5](#5)

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

Let sub_ext be
the result of submdspan_extents(extents(), slices...) and
let SubExtents be decltype(sub_ext)[.](#5.sentence-1)

[6](#6)

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

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:

- [(6.1)](#6.1)

stride(k) * *de-ice*(sk.stride) if Sk is a specialization of strided_slice andsk.stride < sk.extent is true;

- [(6.2)](#6.2)

otherwise, stride(k)[.](#6.sentence-1)

[7](#7)

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

Let P be a parameter pack
such that is_same_v<make_index_sequence<rank()>, index_sequence<P...>> is true[.](#7.sentence-1)

[8](#8)

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

If *first_*<index_type, k>(slices...) equals extents().extent(k) for any rank index k of extents(), then
let offset be a value of type size_t equal to(*this).required_span_size()[.](#8.sentence-1)

Otherwise,
let offset be a value of type size_t equal to(*this)(*first_*<index_type, P>(slices...)...)[.](#8.sentence-2)

[9](#9)

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

Given a layout mapping type M, a type S is a[*unit-stride slice for M*](#def:slice,unit-stride "23.7.3.7.6.1 Common [mdspan.sub.map.common]") if

- [(9.1)](#9.1)

S is a specialization of strided_slice where S​::​stride_type models [*integral-constant-like*](span.syn#concept:integral-constant-like "23.7.2.1 Header <span> synopsis [span.syn]") and S​::​stride_type​::​value equals 1,

- [(9.2)](#9.2)

S models [*index-pair-like*](mdspan.syn#concept:index-pair-like "23.7.3.2 Header <mdspan> synopsis [mdspan.syn]")<M​::​index_type>, or

- [(9.3)](#9.3)

is_convertible_v<S, full_extent_t> is true[.](#9.sentence-1)
