[#absl-AnySpan] = xref:absl.adoc[absl]::AnySpan :relfileprefix: ../ :mrdocs: A type‐erased, non‐owning view over a random‐access sequence. == Synopsis Declared in `<absl/types/any_span.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename T> class AnySpan; ---- == Description 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. == Types [cols="1,4"] |=== | Name| Description | xref:absl/AnySpan/const_iterator.adoc[`const_iterator`] | Random‐access iterator over the const elements of an `AnySpan`. | xref:absl/AnySpan/iterator.adoc[`iterator`] | Random‐access iterator over the elements of an `AnySpan`. |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:absl/AnySpan/absl_internal_is_view.adoc[`absl_internal_is_view`] | Tag marking `AnySpan` as a view type. | xref:absl/AnySpan/const_pointer.adoc[`const_pointer`] | A pointer to a const element. | xref:absl/AnySpan/const_reference.adoc[`const_reference`] | A reference to a const element. | xref:absl/AnySpan/const_reverse_iterator.adoc[`const_reverse_iterator`] | A reverse iterator over const elements. | xref:absl/AnySpan/difference_type.adoc[`difference_type`] | A signed type used for iterator differences. | xref:absl/AnySpan/element_type.adoc[`element_type`] | The element type, including any const‐qualification. | xref:absl/AnySpan/pointer.adoc[`pointer`] | A pointer to an element. | xref:absl/AnySpan/reference.adoc[`reference`] | A reference to an element. | xref:absl/AnySpan/reverse_iterator.adoc[`reverse_iterator`] | A reverse iterator over the elements. | xref:absl/AnySpan/size_type.adoc[`size_type`] | An unsigned type used for sizes and indices. | xref:absl/AnySpan/value_type.adoc[`value_type`] | The element type with const removed. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/AnySpan/2constructor-0c.adoc[`AnySpan`] [.small]#[constructor]# | Constructors | xref:absl/AnySpan/at.adoc[`at`] | Returns a reference to the element at `index`, with bounds checking. | xref:absl/AnySpan/back.adoc[`back`] | Returns a reference to the last element; the span must not be empty. | xref:absl/AnySpan/begin.adoc[`begin`] | Returns an iterator to the first element. | xref:absl/AnySpan/cbegin.adoc[`cbegin`] | Returns a const iterator to the first element. | xref:absl/AnySpan/cend.adoc[`cend`] | Returns a const iterator just past the last element. | xref:absl/AnySpan/crbegin.adoc[`crbegin`] | Returns a const reverse iterator to the last element. | xref:absl/AnySpan/crend.adoc[`crend`] | Returns a const reverse iterator just before the first element. | xref:absl/AnySpan/empty.adoc[`empty`] | Reports whether this span is empty. | xref:absl/AnySpan/end.adoc[`end`] | Returns an iterator just past the last element. | xref:absl/AnySpan/first.adoc[`first`] | Returns a span containing the first `len` elements. | xref:absl/AnySpan/front.adoc[`front`] | Returns a reference to the first element; the span must not be empty. | xref:absl/AnySpan/last.adoc[`last`] | Returns a span containing the last `len` elements. | xref:absl/AnySpan/operator_subs.adoc[`operator[]`] | Returns a reference to the element at `index`. | xref:absl/AnySpan/rbegin.adoc[`rbegin`] | Returns a reverse iterator to the last element. | xref:absl/AnySpan/rend.adoc[`rend`] | Returns a reverse iterator just before the first element. | xref:absl/AnySpan/size.adoc[`size`] | Returns the number of elements in this span. | xref:absl/AnySpan/subspan.adoc[`subspan`] | Returns a subspan starting at `pos` and spanning `len` elements. |=== == Static Data Members [cols="1,4"] |=== | Name| Description | xref:absl/AnySpan/npos.adoc[`npos`] | Sentinel size value meaning "until the end of the span". |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:absl/operator_not_eq-0d2.adoc[absl::operator!=]` | Compares two spans for inequality. | `xref:absl/operator_eq-0b9.adoc[absl::operator==]` | Compares two spans for element‐wise equality. | `xref:absl/operator_not_eq-07a.adoc[absl::operator!=]` | Compares two const spans for inequality. | `xref:absl/operator_eq-029.adoc[absl::operator==]` | Compares two const spans for element‐wise equality. | `absl::AnySpan` | A type‐erased, non‐owning view over a random‐access sequence. | `xref:absl/AbslHashValue-0c4.adoc[absl::AbslHashValue]` | Hashes the span's elements for use with `absl::Hash`. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/MakeAnySpan-0a.adoc[`MakeAnySpan`] | Constructs an `AnySpan` from a non‐view container or array. | xref:absl/MakeAnySpan-0c.adoc[`MakeAnySpan`] | Constructs an `AnySpan` from a view container or array. | xref:absl/MakeAnySpan-0f.adoc[`MakeAnySpan`] | Constructs an `AnySpan` from a pointer and a size. | xref:absl/MakeConstAnySpan-05.adoc[`MakeConstAnySpan`] | Constructs a const `AnySpan` from a non‐view container or array. | xref:absl/MakeConstAnySpan-08.adoc[`MakeConstAnySpan`] | Constructs a const `AnySpan` from a pointer and a size. | xref:absl/MakeConstAnySpan-0e.adoc[`MakeConstAnySpan`] | Constructs a const `AnySpan` from a view container or array. | xref:absl/MakeConstDerefAnySpan-0c.adoc[`MakeConstDerefAnySpan`] | Constructs a const `AnySpan` dereferencing a view container of pointers. | xref:absl/MakeConstDerefAnySpan-0f.adoc[`MakeConstDerefAnySpan`] | Constructs a const `AnySpan` dereferencing a non‐view container of pointers. | xref:absl/MakeDerefAnySpan-00.adoc[`MakeDerefAnySpan`] | Constructs an `AnySpan` that dereferences a view container of pointers. | xref:absl/MakeDerefAnySpan-05.adoc[`MakeDerefAnySpan`] | Constructs an `AnySpan` that dereferences a non‐view container of pointers. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#