absl::Span::Span

Constructors

Synopses

Declared in <absl/types/span.h>

Constructs an empty span.

constexpr
Span() noexcept;
» more...

Constructs a span referring to a C array.

template<size_t N>
constexpr
Span(T(& a)[]) noexcept;
» more...

Constructs a read-only span from an initializer list.

template<
    typename LazyT = T,
    typename = LazyT>
Span(std::initializer_list<value_type> v) noexcept;
» more...

Constructs a mutable span from a container.

template<
    typename V,
    typename = EnableIfConvertibleFrom<V>,
    typename = V,
    typename = span_internal::EnableIfNotIsView<V>>
explicit
Span(V& v) noexcept;
» more...

Constructs a mutable span from a view type (no lifetime bound).

template<
    typename V,
    typename = EnableIfConvertibleFrom<V>,
    typename = V,
    span_internal::EnableIfIsView<V> = 0>
explicit
Span(V& v) noexcept;
» more...

Constructs a read-only Span<const T> from a container.

template<
    typename V,
    typename = EnableIfConvertibleFrom<V>,
    typename = V,
    typename = span_internal::EnableIfNotIsView<V>>
constexpr
Span(V const& v) noexcept;
» more...

Constructs a read-only span from a view type (no lifetime bound).

template<
    typename V,
    typename = EnableIfConvertibleFrom<V>,
    typename = V,
    span_internal::EnableIfIsView<V> = 0>
constexpr
Span(V const& v) noexcept;
» more...

Constructs a span from a pointer and a length.

constexpr
Span(
    pointer array,
    size_type length) noexcept;
» more...

Parameters

NameDescription
aThe array to refer to.
vThe initializer list whose data the span refers to.
arrayPointer to the first element.
lengthNumber of elements in the span.