[span.elem]

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

## 23.7 Views [[views]](views#span.elem)

### 23.7.2 Contiguous access [[views.contiguous]](views.contiguous#span.elem)

#### 23.7.2.2 Class template span [[views.span]](views.span#span.elem)

#### 23.7.2.2.6 Element access [span.elem]

[ð](#lib:operator%5b%5d,span)

`constexpr reference operator[](size_type idx) const;
`

[1](#1)

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

*Hardened preconditions*: idx < size() is true[.](#1.sentence-1)

[2](#2)

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

*Returns*: *(data() + idx)[.](#2.sentence-1)

[3](#3)

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

*Throws*: Nothing[.](#3.sentence-1)

[ð](#lib:span,at)

`constexpr reference at(size_type idx) const;
`

[4](#4)

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

*Returns*: *(data() + idx)[.](#4.sentence-1)

[5](#5)

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

*Throws*: out_of_range if idx >= size() is true[.](#5.sentence-1)

[ð](#lib:span,front)

`constexpr reference front() const;
`

[6](#6)

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

*Hardened preconditions*: empty() is false[.](#6.sentence-1)

[7](#7)

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

*Returns*: *data()[.](#7.sentence-1)

[8](#8)

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

*Throws*: Nothing[.](#8.sentence-1)

[ð](#lib:span,back)

`constexpr reference back() const;
`

[9](#9)

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

*Hardened preconditions*: empty() is false[.](#9.sentence-1)

[10](#10)

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

*Returns*: *(data() + (size() - 1))[.](#10.sentence-1)

[11](#11)

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

*Throws*: Nothing[.](#11.sentence-1)

[ð](#lib:span,data)

`constexpr pointer data() const noexcept;
`

[12](#12)

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

*Returns*: *data_*[.](#12.sentence-1)
