[#absl-AnySpan]
= xref:absl.adoc[absl]::AnySpan
:relfileprefix: ../
:mrdocs:

A type&hyphen;erased, non&hyphen;owning view over a random&hyphen;access sequence&period;

== Synopsis

Declared in `&lt;absl&sol;types&sol;any&lowbar;span&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename T&gt;
class AnySpan;
----

== Description

Like `absl&colon;&colon;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&period; It must not outlive the data, transform, or container it refers to&period;

== Types

[cols="1,4"]
|===
| Name| Description
| xref:absl/AnySpan/const_iterator.adoc[`const&lowbar;iterator`] 
| Random&hyphen;access iterator over the const elements of an `AnySpan`&period;
| xref:absl/AnySpan/iterator.adoc[`iterator`] 
| Random&hyphen;access iterator over the elements of an `AnySpan`&period;
|===


== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:absl/AnySpan/absl_internal_is_view.adoc[`absl&lowbar;internal&lowbar;is&lowbar;view`] 
| Tag marking `AnySpan` as a view type&period;
| xref:absl/AnySpan/const_pointer.adoc[`const&lowbar;pointer`] 
| A pointer to a const element&period;
| xref:absl/AnySpan/const_reference.adoc[`const&lowbar;reference`] 
| A reference to a const element&period;
| xref:absl/AnySpan/const_reverse_iterator.adoc[`const&lowbar;reverse&lowbar;iterator`] 
| A reverse iterator over const elements&period;
| xref:absl/AnySpan/difference_type.adoc[`difference&lowbar;type`] 
| A signed type used for iterator differences&period;
| xref:absl/AnySpan/element_type.adoc[`element&lowbar;type`] 
| The element type, including any const&hyphen;qualification&period;
| xref:absl/AnySpan/pointer.adoc[`pointer`] 
| A pointer to an element&period;
| xref:absl/AnySpan/reference.adoc[`reference`] 
| A reference to an element&period;
| xref:absl/AnySpan/reverse_iterator.adoc[`reverse&lowbar;iterator`] 
| A reverse iterator over the elements&period;
| xref:absl/AnySpan/size_type.adoc[`size&lowbar;type`] 
| An unsigned type used for sizes and indices&period;
| xref:absl/AnySpan/value_type.adoc[`value&lowbar;type`] 
| The element type with const removed&period;
|===


== 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&period;
| xref:absl/AnySpan/back.adoc[`back`] 
| Returns a reference to the last element&semi; the span must not be empty&period;
| xref:absl/AnySpan/begin.adoc[`begin`] 
| Returns an iterator to the first element&period;
| xref:absl/AnySpan/cbegin.adoc[`cbegin`] 
| Returns a const iterator to the first element&period;
| xref:absl/AnySpan/cend.adoc[`cend`] 
| Returns a const iterator just past the last element&period;
| xref:absl/AnySpan/crbegin.adoc[`crbegin`] 
| Returns a const reverse iterator to the last element&period;
| xref:absl/AnySpan/crend.adoc[`crend`] 
| Returns a const reverse iterator just before the first element&period;
| xref:absl/AnySpan/empty.adoc[`empty`] 
| Reports whether this span is empty&period;
| xref:absl/AnySpan/end.adoc[`end`] 
| Returns an iterator just past the last element&period;
| xref:absl/AnySpan/first.adoc[`first`] 
| Returns a span containing the first `len` elements&period;
| xref:absl/AnySpan/front.adoc[`front`] 
| Returns a reference to the first element&semi; the span must not be empty&period;
| xref:absl/AnySpan/last.adoc[`last`] 
| Returns a span containing the last `len` elements&period;
| xref:absl/AnySpan/operator_subs.adoc[`operator&lsqb;&rsqb;`] 
| Returns a reference to the element at `index`&period;
| xref:absl/AnySpan/rbegin.adoc[`rbegin`] 
| Returns a reverse iterator to the last element&period;
| xref:absl/AnySpan/rend.adoc[`rend`] 
| Returns a reverse iterator just before the first element&period;
| xref:absl/AnySpan/size.adoc[`size`] 
| Returns the number of elements in this span&period;
| xref:absl/AnySpan/subspan.adoc[`subspan`] 
| Returns a subspan starting at `pos` and spanning `len` elements&period;
|===


== Static Data Members

[cols="1,4"]
|===
| Name| Description
| xref:absl/AnySpan/npos.adoc[`npos`] 
| Sentinel size value meaning &quot;until the end of the span&quot;&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:absl/operator_not_eq-0d2.adoc[absl::operator!&equals;]`
| Compares two spans for inequality&period;
| `xref:absl/operator_eq-0b9.adoc[absl::operator&equals;&equals;]`
| Compares two spans for element&hyphen;wise equality&period;
| `xref:absl/operator_not_eq-07a.adoc[absl::operator!&equals;]`
| Compares two const spans for inequality&period;
| `xref:absl/operator_eq-029.adoc[absl::operator&equals;&equals;]`
| Compares two const spans for element&hyphen;wise equality&period;
| `absl::AnySpan`
| A type&hyphen;erased, non&hyphen;owning view over a random&hyphen;access sequence&period;
| `xref:absl/AbslHashValue-0c4.adoc[absl::AbslHashValue]`
| Hashes the span&apos;s elements for use with `absl&colon;&colon;Hash`&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/MakeAnySpan-0a.adoc[`MakeAnySpan`]
| Constructs an `AnySpan` from a non&hyphen;view container or array&period;
| xref:absl/MakeAnySpan-0c.adoc[`MakeAnySpan`]
| Constructs an `AnySpan` from a view container or array&period;
| xref:absl/MakeAnySpan-0f.adoc[`MakeAnySpan`]
| Constructs an `AnySpan` from a pointer and a size&period;
| xref:absl/MakeConstAnySpan-05.adoc[`MakeConstAnySpan`]
| Constructs a const `AnySpan` from a non&hyphen;view container or array&period;
| xref:absl/MakeConstAnySpan-08.adoc[`MakeConstAnySpan`]
| Constructs a const `AnySpan` from a pointer and a size&period;
| xref:absl/MakeConstAnySpan-0e.adoc[`MakeConstAnySpan`]
| Constructs a const `AnySpan` from a view container or array&period;
| xref:absl/MakeConstDerefAnySpan-0c.adoc[`MakeConstDerefAnySpan`]
| Constructs a const `AnySpan` dereferencing a view container of pointers&period;
| xref:absl/MakeConstDerefAnySpan-0f.adoc[`MakeConstDerefAnySpan`]
| Constructs a const `AnySpan` dereferencing a non&hyphen;view container of pointers&period;
| xref:absl/MakeDerefAnySpan-00.adoc[`MakeDerefAnySpan`]
| Constructs an `AnySpan` that dereferences a view container of pointers&period;
| xref:absl/MakeDerefAnySpan-05.adoc[`MakeDerefAnySpan`]
| Constructs an `AnySpan` that dereferences a non&hyphen;view container of pointers&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
