Constructors

Synopses

Declared in <absl/types/span.h>

Constructs an empty span.

constexpr
Span() noexcept;

Constructs a span referring to a C array.

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

Constructs a read‐only span from an initializer list.

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

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;

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;

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;

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;

Constructs a span from a pointer and a length.

constexpr
Span(
    pointer array,
    size_type length) noexcept;

Parameters

Name

Description

a

The array to refer to.

v

The initializer list whose data the span refers to.

array

Pointer to the first element.

length

Number of elements in the span.

Created with MrDocs