template <typename T, typename InternalPtrType>
class span
Defined at line 679 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, dynamic_extent, InternalPtrType> ()
Defined at line 694 of file ../../third_party/mini_chromium/src/base/containers/span.h
template <typename It>
void span<T, dynamic_extent, InternalPtrType> (It first, StrictNumeric<size_t> count)
Constructs a span from a contiguous iterator and a size.
# 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 704 of file ../../third_party/mini_chromium/src/base/containers/span.h
template <typename It, typename End>
void span<T, dynamic_extent, InternalPtrType> (It begin, End end)
Constructs a span from a contiguous iterator and a size.
# Safety
The begin and end iterators must be for the same allocation, and `begin
<
=
end` 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 737 of file ../../third_party/mini_chromium/src/base/containers/span.h
template <size_t N>
void span<T, dynamic_extent, InternalPtrType> (T (&)[N] arr)
NOLINTNEXTLINE(google-explicit-constructor)
Defined at line 754 of file ../../third_party/mini_chromium/src/base/containers/span.h
template <typename R>
void span<T, dynamic_extent, InternalPtrType> (R && range)
NOLINTNEXTLINE(google-explicit-constructor)
Defined at line 763 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 772 of file ../../third_party/mini_chromium/src/base/containers/span.h
template <size_t Count>
span<T, Count> last ()
Defined at line 781 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 796 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 809 of file ../../third_party/mini_chromium/src/base/containers/span.h
template <size_t Offset, size_t Count = dynamic_extent>
span<T, Count> subspan ()
Defined at line 820 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 851 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 893 of file ../../third_party/mini_chromium/src/base/containers/span.h
template <size_t Offset>
std::pair<span<T, Offset>, span<T>> split_at ()
An overload of `split_at` which returns a fixed-size span.
# Checks
The function CHECKs that the span contains at least `Offset` elements and
will terminate otherwise.
Defined at line 903 of file ../../third_party/mini_chromium/src/base/containers/span.h
size_t size ()
[span.obs], span observers
Defined at line 909 of file ../../third_party/mini_chromium/src/base/containers/span.h
size_t size_bytes ()
Defined at line 910 of file ../../third_party/mini_chromium/src/base/containers/span.h
bool empty ()
Defined at line 911 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 918 of file ../../third_party/mini_chromium/src/base/containers/span.h
T & front ()
Returns a reference to the first element in the span.
# Checks
The function CHECKs that the span is not empty and will terminate
otherwise.
Defined at line 930 of file ../../third_party/mini_chromium/src/base/containers/span.h
T & back ()
Returns a reference to the last element in the span.
# Checks
The function CHECKs that the span is not empty and will terminate
otherwise.
Defined at line 942 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 956 of file ../../third_party/mini_chromium/src/base/containers/span.h
iterator begin ()
[span.iter], span iterator support
Defined at line 959 of file ../../third_party/mini_chromium/src/base/containers/span.h
iterator end ()
Defined at line 966 of file ../../third_party/mini_chromium/src/base/containers/span.h
reverse_iterator rbegin ()
Defined at line 973 of file ../../third_party/mini_chromium/src/base/containers/span.h
reverse_iterator rend ()
Defined at line 977 of file ../../third_party/mini_chromium/src/base/containers/span.h
void copy_from (span<const T> 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 991 of file ../../third_party/mini_chromium/src/base/containers/span.h
Friends
template <class U, size_t M>
bool span (span<T, dynamic_extent, InternalPtrType> lhs, span<U, M> rhs)
template <typename T, typename InternalPtrType>
bool span<T, dynamic_extent, InternalPtrType> (span<T, dynamic_extent, InternalPtrType> lhs, span<const T> rhs)
template <typename Ttypename InternalPtrType>
bool span<Tdynamic_extentInternalPtrType> (span<T, dynamic_extent, InternalPtrType> lhsspan<T, dynamic_extent, InternalPtrType> rhs)