A non-owning view over a contiguous sequence of objects.
Declared in <absl/types/span.h>
template<typename T>
class Span;
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.
| Name | Description |
|---|---|
absl_internal_is_view | Tag marking Span as a view type. |
const_iterator | A random-access iterator over const elements. |
const_pointer | A pointer to a const element. |
const_reference | A reference to a const element. |
const_reverse_iterator | A reverse iterator over const elements. |
difference_type | A signed type used for iterator differences. |
element_type | The element type, including any cv-qualification. |
iterator | A random-access iterator over the elements. |
pointer | A pointer to an element. |
reference | A reference to an element. |
reverse_iterator | A reverse iterator over the elements. |
size_type | An unsigned type used for sizes and indices. |
value_type | The element type with cv-qualifiers removed. |
| Name | Description |
|---|---|
Span [constructor] | Constructors |
at | Returns a reference to the ith element, with bounds checking. |
back | Returns a reference to the last element; the span must not be empty. |
begin | Returns an iterator to the first element. |
cbegin | Returns a const iterator to the first element. |
cend | Returns a const iterator just past the last element. |
crbegin | Returns a const reverse iterator to the last element. |
crend | Returns a const reverse iterator just before the first element. |
data | Returns a pointer to the span's underlying array of data. |
empty | Reports whether this span is empty. |
end | Returns an iterator just past the last element. |
first | Returns a span containing the first len elements. |
front | Returns a reference to the first element; the span must not be empty. |
last | Returns a span containing the last len elements. |
length | Returns the length (size) of this span. |
operator[] | Returns a reference to the ith element of this span. |
rbegin | Returns a reverse iterator to the last element. |
remove_prefix | Removes the first n elements from the span. |
remove_suffix | Removes the last n elements from the span. |
rend | Returns a reverse iterator just before the first element. |
size | Returns the number of elements in this span. |
subspan | Returns a subspan starting at pos and spanning len elements. |
| Name | Description |
|---|---|
npos | Sentinel size value meaning "until the end of the span". |
| Name | Description |
|---|---|
absl::AbslHashValue | Hashes the span's elements for use with absl::Hash. |
| Name | Description |
|---|---|
MakeConstSpan | Constructs a Span<const T> from a pointer and a size. |
MakeConstSpan | Constructs a Span<const T> from a C array. |
MakeConstSpan | Constructs a Span<const T> from a [begin, end)] pointer pair. |
MakeSpan | Constructs a mutable Span<T> from a C array. |
MakeSpan | Constructs a mutable Span<T> from a pointer and a size. |
MakeSpan | Constructs a mutable Span<T> from a [begin, end)] pointer pair. |
operator!= | Compares two spans for inequality. |
operator!= | Compares a span to a container for inequality. |
operator!= | Compares two spans for inequality. |
operator!= | Compares two spans for inequality. |
operator< | Compares two spans lexicographically. |
operator< | Compares two spans lexicographically. |
operator< | Compares two spans lexicographically. |
operator< | Compares a span and a container lexicographically. |
operator<= | Compares two spans lexicographically. |
operator<= | Compares two spans lexicographically. |
operator<= | Compares two spans lexicographically. |
operator<= | Compares a span and a container lexicographically. |
operator== | Compares two spans for element-wise equality. |
operator== | Compares two spans for element-wise equality. |
operator== | Compares a span to a container for element-wise equality. |
operator== | Compares two spans for element-wise equality. |
operator> | Compares two spans lexicographically. |
operator> | Compares two spans lexicographically. |
operator> | Compares two spans lexicographically. |
operator> | Compares a span and a container lexicographically. |
operator>= | Compares two spans lexicographically. |
operator>= | Compares two spans lexicographically. |
operator>= | Compares two spans lexicographically. |
operator>= | Compares a span and a container lexicographically. |