absl::AnySpan::AnySpan

Constructs a span wrapping a mutable array (transform by copy).

Synopsis

Declared in <absl/types/any_span.h>

template<
    typename Element,
    typename Transform,
    typename = Element,
    typename = EnableIfTransformIsValid<Transform, Element&>,
    EnableIfTransformIsByCopy<Transform> = true>
constexpr
AnySpan(
    Element* ptr,
    size_type size,
    Transform const& transform);

Description

The transform must be a function object whose const operator() takes an Element and returns a reference to T or a compatible object. Both the transform and array must outlive this span.

Parameters

NameDescription
ptrPointer to the first element.
sizeNumber of elements.
transformFunctor applied to each element on access.