template <typename T, size_t Extent = dynamic_extent, typename InternalPtrType = T*>

class span

Defined at line 262 of file ../../third_party/mini_chromium/src/base/containers/span.h

[span], class template span

Public Members

static const size_t extent

Public Methods

void span<T, Extent, InternalPtrType> ()

[span.cons], span constructors, copy, assignment, and destructor

Defined at line 277 of file ../../third_party/mini_chromium/src/base/containers/span.h

template <typename It, size_t M>
void span<T, Extent, InternalPtrType> (It first, std::integral_constant<size_t, M> count)

Defined at line 283 of file ../../third_party/mini_chromium/src/base/containers/span.h

template <typename It>
void span<T, Extent, InternalPtrType> (It first, StrictNumeric<size_t> count)

Constructs a span from a contiguous iterator and a size.

# Checks

The function CHECKs that `count` matches the template parameter `N` and

will terminate otherwise.

# Safety

The iterator must point to the first of at least `count` many elements, or

Undefined Behaviour can result as the span will allow access beyond the

valid range of the collection pointed to by the iterator.

Defined at line 300 of file ../../third_party/mini_chromium/src/base/containers/span.h

template <typename It, typename End>
void span<T, Extent, InternalPtrType> (It begin, End end)

Constructs a span from a contiguous iterator and a size.

# Checks

The function CHECKs that `it

<

= end` and will terminate otherwise.

# Safety

The begin and end iterators must be for the same allocation or Undefined

Behaviour can result as the span will allow access beyond the valid range

of the collection pointed to by `begin`.

Defined at line 341 of file ../../third_party/mini_chromium/src/base/containers/span.h

void span<T, Extent, InternalPtrType> (T (&)[N] arr)

NOLINTNEXTLINE(google-explicit-constructor)

Defined at line 357 of file ../../third_party/mini_chromium/src/base/containers/span.h

template <typename R, size_t X = internal::ExtentV<R>>
void span<T, Extent, InternalPtrType> (R && range)

NOLINTNEXTLINE(google-explicit-constructor)

Defined at line 366 of file ../../third_party/mini_chromium/src/base/containers/span.h

template <size_t Count>
span<T, Count> first ()

[span.sub], span subviews

Defined at line 375 of file ../../third_party/mini_chromium/src/base/containers/span.h

template <size_t Count>
span<T, Count> last ()

Defined at line 385 of file ../../third_party/mini_chromium/src/base/containers/span.h

span<T> first (StrictNumeric<size_t> count)

Returns a span over the first `count` elements.

# Checks

The function CHECKs that the span contains at least `count` elements and

will terminate otherwise.

Defined at line 400 of file ../../third_party/mini_chromium/src/base/containers/span.h

span<T> last (StrictNumeric<size_t> count)

Returns a span over the last `count` elements.

# Checks

The function CHECKs that the span contains at least `count` elements and

will terminate otherwise.

Defined at line 413 of file ../../third_party/mini_chromium/src/base/containers/span.h

template <size_t Offset, size_t Count = dynamic_extent>
auto subspan ()

Defined at line 423 of file ../../third_party/mini_chromium/src/base/containers/span.h

span<T> subspan (size_t offset, size_t count)

Returns a span over the first `count` elements starting at the given

`offset` from the start of the span.

# Checks

The function CHECKs that the span contains at least `offset + count`

elements, or at least `offset` elements if `count` is not specified, and

will terminate otherwise.

Defined at line 452 of file ../../third_party/mini_chromium/src/base/containers/span.h

std::pair<span<T>, span<T>> split_at (size_t offset)

Splits a span into two at the given `offset`, returning two spans that

cover the full range of the original span.

Similar to calling subspan() with the `offset` as the length on the first

call, and then the `offset` as the offset in the second.

The split_at

<N

>() overload allows construction of a fixed-size span from a

compile-time constant. If the input span is fixed-size, both output output

spans will be. Otherwise, the first will be fixed-size and the second will

be dynamic-size.

This is a non-std extension that is inspired by the Rust slice::split_at()

and split_at_mut() methods.

# Checks

The function CHECKs that the span contains at least `offset` elements and

will terminate otherwise.

Defined at line 493 of file ../../third_party/mini_chromium/src/base/containers/span.h

template <size_t Offset>
std::pair<span<T, Offset>, span<T, N - Offset>> split_at ()

Defined at line 499 of file ../../third_party/mini_chromium/src/base/containers/span.h

size_t size ()

[span.obs], span observers

Defined at line 505 of file ../../third_party/mini_chromium/src/base/containers/span.h

size_t size_bytes ()

Defined at line 506 of file ../../third_party/mini_chromium/src/base/containers/span.h

bool empty ()

Defined at line 507 of file ../../third_party/mini_chromium/src/base/containers/span.h

T & operator[] (size_t idx)

[span.elem], span element access

# Checks

The function CHECKs that the `idx` is inside the span and will terminate

otherwise.

Defined at line 514 of file ../../third_party/mini_chromium/src/base/containers/span.h

T & front ()

Defined at line 521 of file ../../third_party/mini_chromium/src/base/containers/span.h

T & back ()

Defined at line 529 of file ../../third_party/mini_chromium/src/base/containers/span.h

T * data ()

Returns a pointer to the first element in the span. If the span is empty

(`size()` is 0), the returned pointer may or may not be null, and it must

not be dereferenced.

It is always valid to add `size()` to the the pointer in C++ code, though

it may be invalid in C code when the span is empty.

Defined at line 544 of file ../../third_party/mini_chromium/src/base/containers/span.h

iterator begin ()

[span.iter], span iterator support

Defined at line 547 of file ../../third_party/mini_chromium/src/base/containers/span.h

iterator end ()

Defined at line 554 of file ../../third_party/mini_chromium/src/base/containers/span.h

reverse_iterator rbegin ()

Defined at line 561 of file ../../third_party/mini_chromium/src/base/containers/span.h

reverse_iterator rend ()

Defined at line 565 of file ../../third_party/mini_chromium/src/base/containers/span.h

void copy_from (span<const T, N> other)

Bounds-checked copy from a non-overlapping span. The spans must be the

exact same size or a hard CHECK() occurs. If the two spans overlap,

Undefined Behaviour occurs.

This is a non-std extension that is inspired by the Rust

slice::copy_from_slice() method.

# Checks

The function CHECKs that the `other` span has the same size as itself and

will terminate otherwise.

Defined at line 579 of file ../../third_party/mini_chromium/src/base/containers/span.h

void span<T, Extent, InternalPtrType> (std::span<std::remove_const_t<T>, N> other)

Implicit conversion from std::span

<T

, N> to base::span

<T

, N>.

We get other conversions for free from std::span's constructors, but it

does not deduce N on its range constructor.

Defined at line 615 of file ../../third_party/mini_chromium/src/base/containers/span.h

void span<T, Extent, InternalPtrType> (std::span<T, N> other)

Defined at line 620 of file ../../third_party/mini_chromium/src/base/containers/span.h

std::span<T, N> operator std::span<type-parameter-0-0, value-parameter-0-1> ()

Implicit conversion from base::span

<T

, N> to std::span

<T

, N>.

We get other conversions for free from std::span's constructors, but it

does not deduce N on its range constructor.

Defined at line 631 of file ../../third_party/mini_chromium/src/base/containers/span.h

std::span<const T, N> operator std::span<const type-parameter-0-0, value-parameter-0-1> ()

Defined at line 632 of file ../../third_party/mini_chromium/src/base/containers/span.h

Friends

template <class U, size_t M>
bool span (span<T, N, InternalPtrType> lhs, span<U, M> rhs)
template <typename T, size_t Extent = dynamic_extent, typename InternalPtrType = T*>
bool span (span<T, N, InternalPtrType> lhs, span<const T, N> rhs)
template <typename Tsize_t Extent = dynamic_extenttypename InternalPtrType = T*>
bool span (span<T, N, InternalPtrType> lhsspan<T, N, InternalPtrType> rhs)