absl::MakeSpan

MakeSpan overloads

Synopses

Declared in <absl/types/span.h>

Constructs a mutable Span from a view container.

template<
    int& ExplicitArgumentBarrier...,
    typename C>
constexpr
decltype(absl::MakeSpan(span_internal::GetData(c),
                                                c.size()))
MakeSpan(C& c) noexcept
requires span_internal::IsView<C>::value;
» more...

Constructs a mutable Span from a non-view container.

template<
    int& ExplicitArgumentBarrier...,
    typename C>
constexpr
decltype(absl::MakeSpan(span_internal::GetData(c),
                                                c.size()))
MakeSpan(C& c) noexcept
requires !span_internal::IsView<C>::value;
» more...

Constructs a mutable Span from a non-view container.

template<
    int& ExplicitArgumentBarrier...,
    typename C>
constexpr
decltype(absl::MakeSpan(span_internal::GetData(c),
                                                c.size()))
MakeSpan(C& c) noexcept
requires !span_internal::IsView<C>::value;
» more...

Constructs a mutable Span<T> from a C array.

template<
    int& ExplicitArgumentBarrier...,
    typename T,
    size_t N>
constexpr
Span<T>
MakeSpan(T(& array)[]) noexcept;
» more...

Constructs a mutable Span<T> from a [begin, end)] pointer pair.

template<
    int& ExplicitArgumentBarrier...,
    typename T>
Span<T>
MakeSpan(
    T* begin,
    T* end) noexcept;
» more...

Constructs a mutable Span<T> from a pointer and a size.

template<
    int& ExplicitArgumentBarrier...,
    typename T>
constexpr
Span<T>
MakeSpan(
    T* ptr,
    size_t size) noexcept;
» more...

Return Value

  • A span over the elements of c.
  • A span over all elements of array.
  • A span over the range [begin, end)].
  • A span over size elements starting at ptr.

Parameters

NameDescription
cThe container whose data the span refers to.
arrayThe array whose elements the span refers to.
beginPointer to the first element.
endPointer just past the last element.
ptrPointer to the first element.
sizeNumber of elements.