[#bsl-variant-get_allocator]
= xref:bsl.adoc[bsl]::xref:bsl/variant.adoc[variant]::get&lowbar;allocator
:relfileprefix: ../../
:mrdocs:

Return a copy of this object&apos;s allocator&period; At least one alternative of this `variant` object shall be allocator&hyphen;aware&semi; in C&plus;&plus;03, due to language limitations, this method can be called even if no alternative is allocator&hyphen;aware, but returns a non&hyphen;allocator type in that case&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;variant&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;bool t&lowbar;USES&lowbar;BSLMA&lowbar;ALLOC = BloombergLP&colon;&colon;bslstl&colon;&colon;Variant&lowbar;UsesBslmaAllocatorAny&lt;t&lowbar;HEAD, t&lowbar;TAIL&period;&period;&period;&gt;&colon;&colon;value&gt;
requires t&lowbar;USES&lowbar;BSLMA&lowbar;ALLOC
xref:bsl/variant/allocator_type.adoc[allocator&lowbar;type]
get&lowbar;allocator() const noexcept;
----


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