A non‐owning view over a contiguous sequence of objects.
Synopsis
Declared in <absl/types/span.h>
template<typename T>
class Span;
Description
A Span provides a bounds‐checked, std::vector‐like interface over an array whose storage is owned elsewhere. It can be constructed from a pointer and length, a C array, or any contiguous container, and it must not outlive the data it refers to.
Type Aliases
Name |
Description |
Tag marking |
|
A random‐access iterator over const elements. |
|
A pointer to a const element. |
|
A reference to a const element. |
|
A reverse iterator over const elements. |
|
A signed type used for iterator differences. |
|
The element type, including any cv‐qualification. |
|
A random‐access iterator over the elements. |
|
A pointer to an element. |
|
A reference to an element. |
|
A reverse iterator over the elements. |
|
An unsigned type used for sizes and indices. |
|
The element type with cv‐qualifiers removed. |
Member Functions
Name |
Description |
|
Constructors |
Returns a reference to the `i`th element, with bounds checking. |
|
Returns a reference to the last element; the span must not be empty. |
|
Returns an iterator to the first element. |
|
Returns a const iterator to the first element. |
|
Returns a const iterator just past the last element. |
|
Returns a const reverse iterator to the last element. |
|
Returns a const reverse iterator just before the first element. |
|
Returns a pointer to the span's underlying array of data. |
|
Reports whether this span is empty. |
|
Returns an iterator just past the last element. |
|
Returns a span containing the first |
|
Returns a reference to the first element; the span must not be empty. |
|
Returns a span containing the last |
|
Returns the length (size) of this span. |
|
Returns a reference to the `i`th element of this span. |
|
Returns a reverse iterator to the last element. |
|
Removes the first |
|
Removes the last |
|
Returns a reverse iterator just before the first element. |
|
Returns the number of elements in this span. |
|
Returns a subspan starting at |
Static Data Members
Name |
Description |
Sentinel size value meaning "until the end of the span". |
Friends
Name |
Description |
Hashes the span's elements for use with |
Non-Member Functions
Name |
Description |
Constructs a |
|
Constructs a |
|
Constructs a |
|
Constructs a mutable |
|
Constructs a mutable |
|
Constructs a mutable |
|
Compares two spans for inequality. |
|
Compares a span to a container for inequality. |
|
Compares two spans for inequality. |
|
Compares two spans for inequality. |
|
Compares two spans lexicographically. |
|
Compares two spans lexicographically. |
|
Compares two spans lexicographically. |
|
Compares a span and a container lexicographically. |
|
Compares two spans lexicographically. |
|
Compares two spans lexicographically. |
|
Compares two spans lexicographically. |
|
Compares a span and a container lexicographically. |
|
Compares two spans for element‐wise equality. |
|
Compares two spans for element‐wise equality. |
|
Compares a span to a container for element‐wise equality. |
|
Compares two spans for element‐wise equality. |
|
Compares two spans lexicographically. |
|
Compares two spans lexicographically. |
|
Compares two spans lexicographically. |
|
Compares a span and a container lexicographically. |
|
Compares two spans lexicographically. |
|
Compares two spans lexicographically. |
|
Compares two spans lexicographically. |
|
Compares a span and a container lexicographically. |
Created with MrDocs