A type-erased, non-owning view over a random-access sequence.
Declared in <absl/types/any_span.h>
template<typename T>
class AnySpan;
Like absl::Span, an AnySpan refers to elements owned elsewhere, but it can wrap any container, array, or view of a compatible element type and can apply a transform to each element on access. It must not outlive the data, transform, or container it refers to.
| Name | Description |
|---|---|
const_iterator | Random-access iterator over the const elements of an AnySpan. |
iterator | Random-access iterator over the elements of an AnySpan. |
| Name | Description |
|---|---|
absl_internal_is_view | Tag marking AnySpan as a view type. |
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 const-qualification. |
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 const removed. |
| Name | Description |
|---|---|
AnySpan [constructor] | Constructors |
at | Returns a reference to the element at index, 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. |
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. |
operator[] | Returns a reference to the element at index. |
rbegin | Returns a reverse iterator to the last element. |
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::operator!= | Compares two spans for inequality. |
absl::operator== | Compares two spans for element-wise equality. |
absl::operator!= | Compares two const spans for inequality. |
absl::operator== | Compares two const spans for element-wise equality. |
absl::AnySpan | A type-erased, non-owning view over a random-access sequence. |
absl::AbslHashValue | Hashes the span's elements for use with absl::Hash. |
| Name | Description |
|---|---|
MakeAnySpan | Constructs an AnySpan from a non-view container or array. |
MakeAnySpan | Constructs an AnySpan from a view container or array. |
MakeAnySpan | Constructs an AnySpan from a pointer and a size. |
MakeConstAnySpan | Constructs a const AnySpan from a non-view container or array. |
MakeConstAnySpan | Constructs a const AnySpan from a pointer and a size. |
MakeConstAnySpan | Constructs a const AnySpan from a view container or array. |
MakeConstDerefAnySpan | Constructs a const AnySpan dereferencing a view container of pointers. |
MakeConstDerefAnySpan | Constructs a const AnySpan dereferencing a non-view container of pointers. |
MakeDerefAnySpan | Constructs an AnySpan that dereferences a view container of pointers. |
MakeDerefAnySpan | Constructs an AnySpan that dereferences a non-view container of pointers. |