# std::span<T,Extent>::operator[]

From cppreference.com
< cpp‎ | container‎ | span

constexpr reference operator[](index_type idx) const; |  |

Returns a reference to the `idx`-th element of the sequence. The behavior is undefined if `idx` is out of range (i.e., if it is greater than or equal to size()).

### Parameters

idx | - | the index of the element to access

### Return value

A reference to the `idx`-th element of the sequence, i.e., data()[idx]

### Exceptions

(none)

### See also

data | returns a pointer to the beginning of the sequence of elements (public member function)
size | returns the number of elements in the sequence (public member function)

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/container/span/operator_at&oldid=109449"