# std::span<T,Extent>::first

From cppreference.com
< cpp‎ | container‎ | span

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

Obtains a span that is a view over the first `Count` elements of this span. The behavior is undefined if 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

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

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/container/span/first&oldid=109431"