absl::MakeConstSpan

MakeConstSpan overloads

Synopses

Declared in <absl/types/span.h>

Constructs a Span<const T> from a view container.

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

Constructs a Span<const T> from a non-view container.

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

Constructs a Span<const T> from a non-view container.

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

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

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

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

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

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

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

Return Value

  • A read-only span over the elements of c.
  • A read-only span over all elements of array.
  • A read-only span over the range [begin, end)].
  • A read-only 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.