Namespaces
Variants
Views
Actions

std::span::last

From cppreference.com
< cpp‎ | container‎ | span
template< std::ptrdiff_t Count >
constexpr std::span<element_type, Count> last() const;
constexpr std::span<element_type, std::dynamic_extent> last( std::ptrdiff_t Count ) const;

Obtains a span that is a view over the last Count elements of this span. The behavior is undefined if Count < 0 || Count > size().

[edit] Return value

A span r that is a view over the last Count elements of *this, such that r.data() == this->data() + (this->size() - Count) && r.size() == Count.

[edit] See also

obtains a subspan consisting of the first N elements of the sequence
(public member function) [edit]
obtains a subspan
(public member function) [edit]