std::span<T,Extent>::operator[] (3) - Linux Man Pages

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


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


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()).


idx - the index of the element to access

Return value

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



See also

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