Namespaces
Variants
Views
Actions

std::get(std::span)

From cppreference.com
< cpp‎ | container‎ | span
template< std::size_t I, class T, std::size_t N >
constexpr T& get( std::span<T,N> s ) noexcept;
(since C++20)

Obtains a reference to the Ith element of the span s.

The span must have static extent (i.e., N != std::dynamic_extent) and I must be an integer value in range [0, N). This is enforced at compile time as opposed to operator[].

Contents

[edit] Parameters

s - span whose contents to extract

[edit] Return value

A reference to the Ith element of s.

[edit] Complexity

Constant.

[edit] Example

[edit] See also

accesses an element of the sequence
(public member function) [edit]
tuple accesses specified element
(function template) [edit]
accesses an element of a pair
(function template) [edit]
reads the value of the variant given the index or the type (if the type is unique), throws on error
(function template) [edit]