CppDS.com

C++ 98 11 14 17 20 手册

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

来自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;

获得 span ,其为此 span 的首 Count 个元素上的视图。若 Count > Extent 则程序非良构。若 Count > size() 则行为未定义。

返回值

作为 *this 的首 Count 个元素上的视图的 span r ,满足 r.data() == this->data() && r.size() == Count

参阅

获得由序列末 N 个元素组成的子段
(公开成员函数)
获得子段
(公开成员函数)
关闭