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

A non&hyphen;owning view over a contiguous sequence of objects&period;

== Synopsis

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

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

== Description

A `Span` provides a bounds&hyphen;checked, `std&colon;&colon;vector`&hyphen;like interface over an array whose storage is owned elsewhere&period; 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&period;

== Type Aliases

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


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/Span/2constructor-0a1.adoc[`Span`]         [.small]#[constructor]#
| Constructors
| xref:absl/Span/at.adoc[`at`] 
| Returns a reference to the `i`th element, with bounds checking&period;
| xref:absl/Span/back.adoc[`back`] 
| Returns a reference to the last element&semi; the span must not be empty&period;
| xref:absl/Span/begin.adoc[`begin`] 
| Returns an iterator to the first element&period;
| xref:absl/Span/cbegin.adoc[`cbegin`] 
| Returns a const iterator to the first element&period;
| xref:absl/Span/cend.adoc[`cend`] 
| Returns a const iterator just past the last element&period;
| xref:absl/Span/crbegin.adoc[`crbegin`] 
| Returns a const reverse iterator to the last element&period;
| xref:absl/Span/crend.adoc[`crend`] 
| Returns a const reverse iterator just before the first element&period;
| xref:absl/Span/data.adoc[`data`] 
| Returns a pointer to the span&apos;s underlying array of data&period;
| xref:absl/Span/empty.adoc[`empty`] 
| Reports whether this span is empty&period;
| xref:absl/Span/end.adoc[`end`] 
| Returns an iterator just past the last element&period;
| xref:absl/Span/first.adoc[`first`] 
| Returns a span containing the first `len` elements&period;
| xref:absl/Span/front.adoc[`front`] 
| Returns a reference to the first element&semi; the span must not be empty&period;
| xref:absl/Span/last.adoc[`last`] 
| Returns a span containing the last `len` elements&period;
| xref:absl/Span/length.adoc[`length`] 
| Returns the length (size) of this span&period;
| xref:absl/Span/operator_subs.adoc[`operator&lsqb;&rsqb;`] 
| Returns a reference to the `i`th element of this span&period;
| xref:absl/Span/rbegin.adoc[`rbegin`] 
| Returns a reverse iterator to the last element&period;
| xref:absl/Span/remove_prefix.adoc[`remove&lowbar;prefix`] 
| Removes the first `n` elements from the span&period;
| xref:absl/Span/remove_suffix.adoc[`remove&lowbar;suffix`] 
| Removes the last `n` elements from the span&period;
| xref:absl/Span/rend.adoc[`rend`] 
| Returns a reverse iterator just before the first element&period;
| xref:absl/Span/size.adoc[`size`] 
| Returns the number of elements in this span&period;
| xref:absl/Span/subspan.adoc[`subspan`] 
| Returns a subspan starting at `pos` and spanning `len` elements&period;
|===


== Static Data Members

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


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:absl/AbslHashValue-03.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/MakeConstSpan-05.adoc[`MakeConstSpan`]
| Constructs a `Span&lt;const T&gt;` from a pointer and a size&period;
| xref:absl/MakeConstSpan-06.adoc[`MakeConstSpan`]
| Constructs a `Span&lt;const T&gt;` from a C array&period;
| xref:absl/MakeConstSpan-07.adoc[`MakeConstSpan`]
| Constructs a `Span&lt;const T&gt;` from a `&lsqb;begin, end)&rsqb;` pointer pair&period;
| xref:absl/MakeSpan-0e2.adoc[`MakeSpan`]
| Constructs a mutable `Span&lt;T&gt;` from a C array&period;
| xref:absl/MakeSpan-0e4.adoc[`MakeSpan`]
| Constructs a mutable `Span&lt;T&gt;` from a pointer and a size&period;
| xref:absl/MakeSpan-0f.adoc[`MakeSpan`]
| Constructs a mutable `Span&lt;T&gt;` from a `&lsqb;begin, end)&rsqb;` pointer pair&period;
| xref:absl/operator_not_eq-0624.adoc[`operator!&equals;`]
| Compares two spans for inequality&period;
| xref:absl/operator_not_eq-077.adoc[`operator!&equals;`]
| Compares a span to a container for inequality&period;
| xref:absl/operator_not_eq-0a.adoc[`operator!&equals;`]
| Compares two spans for inequality&period;
| xref:absl/operator_not_eq-0e4.adoc[`operator!&equals;`]
| Compares two spans for inequality&period;
| xref:absl/operator_lt-04c.adoc[`operator&lt;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_lt-06d.adoc[`operator&lt;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_lt-08.adoc[`operator&lt;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_lt-0ed.adoc[`operator&lt;`]
| Compares a span and a container lexicographically&period;
| xref:absl/operator_le-003.adoc[`operator&lt;&equals;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_le-0bf.adoc[`operator&lt;&equals;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_le-0d.adoc[`operator&lt;&equals;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_le-0e.adoc[`operator&lt;&equals;`]
| Compares a span and a container lexicographically&period;
| xref:absl/operator_eq-02b.adoc[`operator&equals;&equals;`]
| Compares two spans for element&hyphen;wise equality&period;
| xref:absl/operator_eq-084.adoc[`operator&equals;&equals;`]
| Compares two spans for element&hyphen;wise equality&period;
| xref:absl/operator_eq-0c1.adoc[`operator&equals;&equals;`]
| Compares a span to a container for element&hyphen;wise equality&period;
| xref:absl/operator_eq-0d6.adoc[`operator&equals;&equals;`]
| Compares two spans for element&hyphen;wise equality&period;
| xref:absl/operator_gt-085.adoc[`operator&gt;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_gt-08f.adoc[`operator&gt;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_gt-091.adoc[`operator&gt;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_gt-0c7.adoc[`operator&gt;`]
| Compares a span and a container lexicographically&period;
| xref:absl/operator_ge-03e0.adoc[`operator&gt;&equals;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_ge-03ec.adoc[`operator&gt;&equals;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_ge-04e.adoc[`operator&gt;&equals;`]
| Compares two spans lexicographically&period;
| xref:absl/operator_ge-06.adoc[`operator&gt;&equals;`]
| Compares a span and a container lexicographically&period;
|===


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