Namespaces
Variants
Views
Actions

std::span::back

From cppreference.com
< cpp‎ | container‎ | span
constexpr reference back() const;

Returns a reference to the last element in the span.

Calling back on an empty span results in undefined behavior.

Contents

[edit] Parameters

(none)

[edit] Return value

A reference to the back element.

[edit] Complexity

Constant

[edit] Notes

For a span c, the expression c.back() is equivalent to *(c.end()-1).

[edit] Example

[edit] See also

access the first element
(public member function) [edit]