Constructors

Synopses

Declared in <absl/types/any_span.h>

Constructs an empty (null) span.

AnySpan() = default;

Converts a mutable span to a const span by copying its internal state.

template<
    typename LazyT = T,
    typename = LazyT>
constexpr
AnySpan(AnySpan<std::remove_const_t<T>> const& other);

Constructs a span wrapping another span of a different element type.

template<
    typename Element,
    typename = EnableIfDifferentElementType<Element>,
    typename = EnableIfTransformIsValid<any_span_transform::IdentityT, Element&>>
constexpr
explicit
AnySpan(AnySpan<Element> const& other);

Constructs a span wrapping an initializer list.

constexpr
AnySpan(std::initializer_list<value_type> l);

Constructs a span from an element getter and size. Not for external use.

AnySpan(
    any_span_internal::Getter<T> getter,
    size_type size);

Constructs a span wrapping an initializer list, applying a transform.

template<
    typename Element,
    typename Transform,
    typename = EnableIfTransformIsValid<Transform, Element const&>,
    EnableIfTransformIsByCopy<Transform> = true>
constexpr
AnySpan(
    std::initializer_list<Element> l,
    Transform const& transform);

Constructs a span wrapping an initializer list, applying a transform.

template<
    typename Element,
    typename Transform = any_span_transform::IdentityT,
    typename = EnableIfTransformIsValid<Transform, Element const&>,
    EnableIfTransformIsByRef<Transform> = true>
constexpr
AnySpan(
    std::initializer_list<Element> l,
    Transform const& transform = any_span_transform::Identity());

Constructs a span wrapping another span, applying a transform (by copy).

template<
    typename Element,
    typename Transform,
    typename = EnableIfTransformIsValid<Transform, Element&>,
    EnableIfTransformIsByCopy<Transform> = true>
constexpr
explicit
AnySpan(
    AnySpan<Element> const& other,
    Transform const& transform);

Constructs a span wrapping another span, applying a transform (by ref).

template<
    typename Element,
    typename Transform,
    typename = EnableIfTransformIsValid<Transform, Element&>,
    EnableIfTransformIsByRef<Transform> = true>
constexpr
explicit
AnySpan(
    AnySpan<Element> const& other,
    Transform const& transform);

Constructs a span wrapping a const non‐view container (transform by copy).

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

Constructs a span wrapping a const view container (transform by copy).

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

Constructs a span wrapping a const non‐view container (transform by ref).

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

Constructs a span wrapping a const view container (transform by ref).

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

Constructs a span wrapping a fixed‐size const array (transform by copy).

template<
    typename Element,
    size_type N,
    typename Transform,
    typename = EnableIfTransformIsValid<Transform, Element const&>,
    EnableIfTransformIsByCopy<Transform> = true>
constexpr
AnySpan(
    Element const(& array)[],
    Transform const& transform);

Constructs a span wrapping a fixed‐size const array (transform by ref).

template<
    typename Element,
    size_type N,
    typename Transform = any_span_transform::IdentityT,
    typename = EnableIfTransformIsValid<Transform, Element const&>,
    EnableIfTransformIsByRef<Transform> = true>
constexpr
AnySpan(
    Element const(& array)[],
    Transform const& transform = any_span_transform::Identity());

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

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

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

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());

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

template<
    typename Element,
    size_type N,
    typename Transform,
    typename = Element,
    typename = EnableIfTransformIsValid<Transform, Element&>,
    EnableIfTransformIsByCopy<Transform> = true>
constexpr
AnySpan(
    Element(& array)[],
    Transform const& transform);

Constructs a span wrapping a fixed‐size mutable array (transform by ref).

template<
    typename Element,
    size_type N,
    typename Transform = any_span_transform::IdentityT,
    typename = Element,
    typename = EnableIfTransformIsValid<Transform, Element&>,
    EnableIfTransformIsByRef<Transform> = true>
constexpr
AnySpan(
    Element(& array)[],
    Transform const& transform = any_span_transform::Identity());

Constructs a span wrapping a const array, applying a transform (by copy).

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

Constructs a span wrapping a const array, applying a transform (by ref).

template<
    typename Element,
    typename Transform = any_span_transform::IdentityT,
    typename = EnableIfTransformIsValid<Transform, Element const&>,
    EnableIfTransformIsByRef<Transform> = true>
constexpr
AnySpan(
    Element const* ptr,
    size_type size,
    Transform const& transform = any_span_transform::Identity());

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

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

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

template<
    typename Element,
    typename Transform = any_span_transform::IdentityT,
    typename = Element,
    typename = EnableIfTransformIsValid<Transform, Element&>,
    EnableIfTransformIsByRef<Transform> = true>
constexpr
AnySpan(
    Element* ptr,
    size_type size,
    Transform const& transform = any_span_transform::Identity());

Parameters

Name

Description

other

The mutable span to convert from.

l

The initializer list whose elements the span refers to.

getter

The internal element accessor.

size

The number of elements.

transform

Functor applied to each element on access.

container

The container whose elements the span refers to.

array

The array whose elements the span refers to.

ptr

Pointer to the first element.

Created with MrDocs