[mdspan.extents.overview]

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

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

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

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

#### 23.7.3.3.1 Overview [mdspan.extents.overview]

The class template extents represents
a multidimensional index space of rank equal to sizeof...(Extents)[.](#sentence-1)

In [[views]](views "23.7 Views"),extents is used synonymously with multidimensional index space[.](#sentence-2)

namespace std {template<class IndexType, size_t... Extents>class [extents](#lib:extents "23.7.3.3.1 Overview [mdspan.extents.overview]") {public:using index_type = IndexType; using size_type = make_unsigned_t<index_type>; using rank_type = size_t; // [[mdspan.extents.obs]](mdspan.extents.obs "23.7.3.3.4 Observers of the multidimensional index space"), observers of the multidimensional index spacestatic constexpr rank_type rank() noexcept { return sizeof...(Extents); }static constexpr rank_type rank_dynamic() noexcept { return *dynamic-index*(rank()); }static constexpr size_t static_extent(rank_type) noexcept; constexpr index_type extent(rank_type) const noexcept; // [[mdspan.extents.cons]](mdspan.extents.cons "23.7.3.3.3 Constructors"), constructorsconstexpr extents() noexcept = default; template<class OtherIndexType, size_t... OtherExtents>constexpr explicit(*see below*) extents(const extents<OtherIndexType, OtherExtents...>&) noexcept; template<class... OtherIndexTypes>constexpr explicit extents(OtherIndexTypes...) noexcept; template<class OtherIndexType, size_t N>constexpr explicit(N != rank_dynamic()) extents(span<OtherIndexType, N>) noexcept; template<class OtherIndexType, size_t N>constexpr explicit(N != rank_dynamic()) extents(const array<OtherIndexType, N>&) noexcept; // [[mdspan.extents.cmp]](mdspan.extents.cmp "23.7.3.3.5 Comparison operators"), comparison operatorstemplate<class OtherIndexType, size_t... OtherExtents>friend constexpr bool operator==(const extents&, const extents<OtherIndexType, OtherExtents...>&) noexcept; // [[mdspan.extents.expo]](mdspan.extents.expo "23.7.3.3.2 Exposition-only helpers"), exposition-only helpersconstexpr size_t *fwd-prod-of-extents*(rank_type) const noexcept; // *exposition only*constexpr size_t *rev-prod-of-extents*(rank_type) const noexcept; // *exposition only*template<class OtherIndexType>static constexpr auto *index-cast*(OtherIndexType&&) noexcept; // *exposition only*private:static constexpr rank_type *dynamic-index*(rank_type) noexcept; // *exposition only*static constexpr rank_type *dynamic-index-inv*(rank_type) noexcept; // *exposition only* array<index_type, rank_dynamic()> *dynamic-extents*{}; // *exposition only*}; template<class... Integrals>explicit extents(Integrals...)-> *see below*;}

[1](#1)

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

*Mandates*: 

- [(1.1)](#1.1)

IndexType is a signed or unsigned integer type, and

- [(1.2)](#1.2)

each element of Extents is either equal to dynamic_extent, or
is representable as a value of type IndexType[.](#1.sentence-1)

[2](#2)

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

Each specialization of extents models [regular](concepts.object#concept:regular "18.6 Object concepts [concepts.object]") and
is trivially copyable[.](#2.sentence-1)

[3](#3)

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

Let Er be the rth element of Extents[.](#3.sentence-1)

Er is a [*dynamic extent*](#def:extent,dynamic "23.7.3.3.1 Overview [mdspan.extents.overview]") if it is equal to dynamic_extent,
otherwise Er is a [*static extent*](#def:extent,static "23.7.3.3.1 Overview [mdspan.extents.overview]")[.](#3.sentence-2)

Let Dr be the value of *dynamic-extents*[*dynamic-index*(r)] if Er is a dynamic extent,
otherwise Er[.](#3.sentence-3)

[4](#4)

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

The rth interval of the multidimensional index space
represented by an extents object is [0,Dr)[.](#4.sentence-1)
