[mdspan.extents.expo]

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

## 23.7 Views [[views]](views#mdspan.extents.expo)

### 23.7.3 Multidimensional access [[views.multidim]](views.multidim#mdspan.extents.expo)

#### 23.7.3.3 Class template extents [[mdspan.extents]](mdspan.extents#expo)

#### 23.7.3.3.2 Exposition-only helpers [mdspan.extents.expo]

[ð](#itemdecl:1)

`static constexpr rank_type dynamic-index(rank_type i) noexcept;
`

[1](#1)

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

*Preconditions*: i <= rank() is true[.](#1.sentence-1)

[2](#2)

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

*Returns*: The number of Er with r<i for which Er is a dynamic extent[.](#2.sentence-1)

[ð](#itemdecl:2)

`static constexpr rank_type dynamic-index-inv(rank_type i) noexcept;
`

[3](#3)

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

*Preconditions*: i < rank_dynamic() is true[.](#3.sentence-1)

[4](#4)

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

*Returns*: The minimum value of r such that *dynamic-index*(r + 1) == i + 1 is true[.](#4.sentence-1)

[ð](#itemdecl:3)

`constexpr size_t fwd-prod-of-extents(rank_type i) const noexcept;
`

[5](#5)

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

*Preconditions*: i <= rank() is true[.](#5.sentence-1)

[6](#6)

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

*Returns*: If i > 0 is true,
the product of extent(k) for all k in the range [0, i),
otherwise 1[.](#6.sentence-1)

[ð](#itemdecl:4)

`constexpr size_t rev-prod-of-extents(rank_type i) const noexcept;
`

[7](#7)

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

*Preconditions*: i < rank() is true[.](#7.sentence-1)

[8](#8)

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

*Returns*: If i + 1 < rank() is true,
the product of extent(k) for all k in the range [i + 1, rank()),
otherwise 1[.](#8.sentence-1)

[ð](#itemdecl:5)

`template<class OtherIndexType>
  static constexpr auto index-cast(OtherIndexType&& i) noexcept;
`

[9](#9)

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

*Effects*: 

- [(9.1)](#9.1)

If OtherIndexType is an integral type other than bool,
then equivalent to return i;,

- [(9.2)](#9.2)

otherwise, equivalent to return static_cast<index_type>(i);[.](#9.sentence-1)

[*Note [1](#note-1)*:

This function will always return an integral type other than bool[.](#9.sentence-2)

Since this function's call sites are constrained on
convertibility of OtherIndexType to index_type,
integer-class types can use the static_cast branch
without loss of precision[.](#9.sentence-3)

â *end note*]
