W3cubDocs

/C++

std::span::first

template< std::ptrdiff_t Count >
constexpr std::span<element_type, Count> first() const;
constexpr std::span<element_type, std::dynamic_extent> first( std::ptrdiff_t Count ) const;

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

Return value

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

See also

obtains a subspan consisting of the last N elements of the sequence
(public member function)
obtains a subspan
(public member function)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/container/span/first