[#absl-AnySpan-2constructor-0c]
= xref:absl.adoc[absl]::xref:absl/AnySpan.adoc[AnySpan]::AnySpan
:relfileprefix: ../../
:mrdocs:

Constructors

== Synopses

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

Constructs an empty (null) span&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:absl/AnySpan/2constructor-08.adoc[AnySpan]() = default;
----

[.small]#xref:absl/AnySpan/2constructor-08.adoc[_» more&period;&period;&period;_]#

Converts a mutable span to a const span by copying its internal state&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename LazyT = T,
    typename = LazyT&gt;
constexpr
xref:absl/AnySpan/2constructor-04.adoc[AnySpan](xref:absl/AnySpan.adoc[AnySpan&lt;std::remove&lowbar;const&lowbar;t&lt;T&gt;&gt;] const& other);
----

[.small]#xref:absl/AnySpan/2constructor-04.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping another span of a different element type&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    typename = xref:absl/AnySpan.adoc[EnableIfDifferentElementType&lt;Element&gt;],
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;any&lowbar;span&lowbar;transform::IdentityT, Element&&gt;]&gt;
constexpr
explicit
xref:absl/AnySpan/2constructor-01f5.adoc[AnySpan](xref:absl/AnySpan.adoc[AnySpan&lt;Element&gt;] const& other);
----

[.small]#xref:absl/AnySpan/2constructor-01f5.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping an initializer list&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
xref:absl/AnySpan/2constructor-0fb.adoc[AnySpan](std::initializer&lowbar;list&lt;value&lowbar;type&gt; l);
----

[.small]#xref:absl/AnySpan/2constructor-0fb.adoc[_» more&period;&period;&period;_]#

Constructs a span from an element getter and size&period; Not for external use&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:absl/AnySpan/2constructor-09f5.adoc[AnySpan](
    any&lowbar;span&lowbar;internal::Getter&lt;T&gt; getter,
    xref:absl/AnySpan/size_type.adoc[size&lowbar;type] size);
----

[.small]#xref:absl/AnySpan/2constructor-09f5.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping an initializer list, applying a transform&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    typename Transform,
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element const&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByCopy&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-064.adoc[AnySpan](
    std::initializer&lowbar;list&lt;Element&gt; l,
    Transform const& transform);
----

[.small]#xref:absl/AnySpan/2constructor-064.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping an initializer list, applying a transform&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    typename Transform = xref:absl/any_span_transform/IdentityT.adoc[any&lowbar;span&lowbar;transform::IdentityT],
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element const&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByRef&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-027.adoc[AnySpan](
    std::initializer&lowbar;list&lt;Element&gt; l,
    Transform const& transform = any&lowbar;span&lowbar;transform&colon;&colon;Identity());
----

[.small]#xref:absl/AnySpan/2constructor-027.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping another span, applying a transform (by copy)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    typename Transform,
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByCopy&lt;Transform&gt;] = true&gt;
constexpr
explicit
xref:absl/AnySpan/2constructor-0a.adoc[AnySpan](
    xref:absl/AnySpan.adoc[AnySpan&lt;Element&gt;] const& other,
    Transform const& transform);
----

[.small]#xref:absl/AnySpan/2constructor-0a.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping another span, applying a transform (by ref)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    typename Transform,
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByRef&lt;Transform&gt;] = true&gt;
constexpr
explicit
xref:absl/AnySpan/2constructor-00b.adoc[AnySpan](
    xref:absl/AnySpan.adoc[AnySpan&lt;Element&gt;] const& other,
    Transform const& transform);
----

[.small]#xref:absl/AnySpan/2constructor-00b.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a const non&hyphen;view container (transform by copy)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Container,
    typename Transform,
    typename = xref:absl/AnySpan.adoc[EnableIfContainer&lt;Container&gt;],
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, decltype(std&colon;&colon;declval&lt;const Container&amp;&gt;()&lsqb;0&rsqb;)&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByCopy&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-023.adoc[AnySpan](
    Container const& container,
    Transform const& transform);
----

[.small]#xref:absl/AnySpan/2constructor-023.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a const view container (transform by copy)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Container,
    typename Transform,
    typename = xref:absl/AnySpan.adoc[EnableIfContainer&lt;Container&gt;],
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, decltype(std&colon;&colon;declval&lt;const Container&amp;&gt;()&lsqb;0&rsqb;)&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByCopy&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-0d8.adoc[AnySpan](
    Container const& container,
    Transform const& transform);
----

[.small]#xref:absl/AnySpan/2constructor-0d8.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a const non&hyphen;view container (transform by ref)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Container,
    typename Transform = xref:absl/any_span_transform/IdentityT.adoc[any&lowbar;span&lowbar;transform::IdentityT],
    typename = xref:absl/AnySpan.adoc[EnableIfContainer&lt;Container&gt;],
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, decltype(std&colon;&colon;declval&lt;const Container&amp;&gt;()&lsqb;0&rsqb;)&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByRef&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-07.adoc[AnySpan](
    Container const& container,
    Transform const& transform = any&lowbar;span&lowbar;transform&colon;&colon;Identity());
----

[.small]#xref:absl/AnySpan/2constructor-07.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a const view container (transform by ref)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Container,
    typename Transform = xref:absl/any_span_transform/IdentityT.adoc[any&lowbar;span&lowbar;transform::IdentityT],
    typename = xref:absl/AnySpan.adoc[EnableIfContainer&lt;Container&gt;],
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, decltype(std&colon;&colon;declval&lt;const Container&amp;&gt;()&lsqb;0&rsqb;)&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByRef&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-0e.adoc[AnySpan](
    Container const& container,
    Transform const& transform = any&lowbar;span&lowbar;transform&colon;&colon;Identity());
----

[.small]#xref:absl/AnySpan/2constructor-0e.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a fixed&hyphen;size const array (transform by copy)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    xref:absl/AnySpan/size_type.adoc[size&lowbar;type] N,
    typename Transform,
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element const&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByCopy&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-0b.adoc[AnySpan](
    Element const(& array)[],
    Transform const& transform);
----

[.small]#xref:absl/AnySpan/2constructor-0b.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a fixed&hyphen;size const array (transform by ref)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    xref:absl/AnySpan/size_type.adoc[size&lowbar;type] N,
    typename Transform = xref:absl/any_span_transform/IdentityT.adoc[any&lowbar;span&lowbar;transform::IdentityT],
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element const&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByRef&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-01f4.adoc[AnySpan](
    Element const(& array)[],
    Transform const& transform = any&lowbar;span&lowbar;transform&colon;&colon;Identity());
----

[.small]#xref:absl/AnySpan/2constructor-01f4.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a mutable container (transform by copy)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Container,
    typename Transform,
    typename = Container,
    typename = xref:absl/AnySpan.adoc[EnableIfContainer&lt;Container&gt;],
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, decltype(std&colon;&colon;declval&lt;Container&amp;&gt;()&lsqb;0&rsqb;)&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByCopy&lt;Transform&gt;] = true&gt;
constexpr
explicit
xref:absl/AnySpan/2constructor-0d1.adoc[AnySpan](
    Container& container,
    Transform const& transform);
----

[.small]#xref:absl/AnySpan/2constructor-0d1.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a mutable container (transform by ref)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Container,
    typename Transform = xref:absl/any_span_transform/IdentityT.adoc[any&lowbar;span&lowbar;transform::IdentityT],
    typename = Container,
    typename = xref:absl/AnySpan.adoc[EnableIfContainer&lt;Container&gt;],
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, decltype(std&colon;&colon;declval&lt;Container&amp;&gt;()&lsqb;0&rsqb;)&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByRef&lt;Transform&gt;] = true&gt;
constexpr
explicit
xref:absl/AnySpan/2constructor-005.adoc[AnySpan](
    Container& container,
    Transform const& transform = any&lowbar;span&lowbar;transform&colon;&colon;Identity());
----

[.small]#xref:absl/AnySpan/2constructor-005.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a fixed&hyphen;size mutable array (transform by copy)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    xref:absl/AnySpan/size_type.adoc[size&lowbar;type] N,
    typename Transform,
    typename = Element,
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByCopy&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-01a.adoc[AnySpan](
    Element(& array)[],
    Transform const& transform);
----

[.small]#xref:absl/AnySpan/2constructor-01a.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a fixed&hyphen;size mutable array (transform by ref)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    xref:absl/AnySpan/size_type.adoc[size&lowbar;type] N,
    typename Transform = xref:absl/any_span_transform/IdentityT.adoc[any&lowbar;span&lowbar;transform::IdentityT],
    typename = Element,
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByRef&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-09e.adoc[AnySpan](
    Element(& array)[],
    Transform const& transform = any&lowbar;span&lowbar;transform&colon;&colon;Identity());
----

[.small]#xref:absl/AnySpan/2constructor-09e.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a const array, applying a transform (by copy)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    typename Transform,
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element const&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByCopy&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-03.adoc[AnySpan](
    Element const* ptr,
    xref:absl/AnySpan/size_type.adoc[size&lowbar;type] size,
    Transform const& transform);
----

[.small]#xref:absl/AnySpan/2constructor-03.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a const array, applying a transform (by ref)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    typename Transform = xref:absl/any_span_transform/IdentityT.adoc[any&lowbar;span&lowbar;transform::IdentityT],
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element const&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByRef&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-0ff.adoc[AnySpan](
    Element const* ptr,
    xref:absl/AnySpan/size_type.adoc[size&lowbar;type] size,
    Transform const& transform = any&lowbar;span&lowbar;transform&colon;&colon;Identity());
----

[.small]#xref:absl/AnySpan/2constructor-0ff.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a mutable array (transform by copy)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    typename Transform,
    typename = Element,
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByCopy&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-066.adoc[AnySpan](
    Element* ptr,
    xref:absl/AnySpan/size_type.adoc[size&lowbar;type] size,
    Transform const& transform);
----

[.small]#xref:absl/AnySpan/2constructor-066.adoc[_» more&period;&period;&period;_]#

Constructs a span wrapping a mutable array (transform by ref)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Element,
    typename Transform = xref:absl/any_span_transform/IdentityT.adoc[any&lowbar;span&lowbar;transform::IdentityT],
    typename = Element,
    typename = xref:absl/AnySpan.adoc[EnableIfTransformIsValid&lt;Transform, Element&&gt;],
    xref:absl/AnySpan.adoc[EnableIfTransformIsByRef&lt;Transform&gt;] = true&gt;
constexpr
xref:absl/AnySpan/2constructor-09f0.adoc[AnySpan](
    Element* ptr,
    xref:absl/AnySpan/size_type.adoc[size&lowbar;type] size,
    Transform const& transform = any&lowbar;span&lowbar;transform&colon;&colon;Identity());
----

[.small]#xref:absl/AnySpan/2constructor-09f0.adoc[_» more&period;&period;&period;_]#

== Parameters

[cols="1,4"]
|===
| Name| Description
| *other*
| The mutable span to convert from&period;
| *l*
| The initializer list whose elements the span refers to&period;
| *getter*
| The internal element accessor&period;
| *size*
| The number of elements&period;
| *transform*
| Functor applied to each element on access&period;
| *container*
| The container whose elements the span refers to&period;
| *array*
| The array whose elements the span refers to&period;
| *ptr*
| Pointer to the first element&period;
|===


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