22 Containers library [containers]

22.7 Views [views]

22.7.3 Class template span [views.span]

22.7.3.3 Subviews [span.sub]

template<size_t Count> constexpr span<element_type, Count> first() const;
Expects: Count <= size() is true.
Effects: Equivalent to: return {data(), Count};
template<size_t Count> constexpr span<element_type, Count> last() const;
Expects: Count <= size() is true.
Effects: Equivalent to: return {data() + (size() - Count), Count};
template<size_t Offset, size_t Count = dynamic_extent> constexpr span<element_type, see below> subspan() const;
Expects:
Offset <= size() && (Count == dynamic_extent || Offset + Count <= size())
is true.
Effects: Equivalent to:
return span<ElementType, see below>(
  data() + Offset, Count != dynamic_extent ? Count : size() - Offset);
Remarks: The second template argument of the returned span type is:
Count != dynamic_extent ? Count
                        : (Extent != dynamic_extent ? Extent - Offset
                                                    : dynamic_extent)
constexpr span<element_type, dynamic_extent> first(index_type count) const;
Expects: count <= size() is true.
Effects: Equivalent to: return {data(), count};
constexpr span<element_type, dynamic_extent> last(index_type count) const;
Expects: count <= size() is true.
Effects: Equivalent to: return {data() + (size() - count), count};
constexpr span<element_type, dynamic_extent> subspan( index_type offset, index_type count = dynamic_extent) const;
Expects:
offset <= size() && (count == dynamic_extent || offset + count <= size())
is true.
Effects: Equivalent to:
return {data() + offset, count == dynamic_extent ? size() - offset : count};