absl::AnySpan::subspan

Returns a subspan starting at pos and spanning len elements.

Synopsis

Declared in <absl/types/any_span.h>

constexpr
AnySpan
subspan(
    size_type pos,
    size_type len = npos) const;

Description

pos must be <= size(). len must be <= size() - pos or npos; when npos, the subspan runs to the end. The container and transform must stay valid, though this span may become invalid before the subspan.

Return Value

A span over the requested range.

Parameters

NameDescription
posIndex of the first element of the subspan.
lenNumber of elements in the subspan, or npos for the rest.