absl::AnySpan::AnySpan

Constructs a span wrapping a mutable container (transform by ref).

Synopsis

Declared in <absl/types/any_span.h>

template<
    typename Container,
    typename Transform = any_span_transform::IdentityT,
    typename = Container,
    typename = EnableIfContainer<Container>,
    typename = EnableIfTransformIsValid<Transform, decltype(std::declval<Container&>()[0])>,
    EnableIfTransformIsByRef<Transform> = true>
constexpr
explicit
AnySpan(
    Container& container,
    Transform const& transform = any_span_transform::Identity());

Description

Only enabled when T is mutable. The transform, container, and its storage must outlive this span; reallocating or resizing the container invalidates the span.

Parameters

NameDescription
containerThe container whose elements the span refers to.
transformFunctor applied to each element on access.