[#bsl-get-0ea]
= xref:bsl.adoc[bsl]::get
:relfileprefix: ../
:mrdocs:

Return a reference to the alternative object with type (template parameter) `t&lowbar;TYPE` in the specified `obj`&period; If `t&lowbar;TYPE` is not the type of the currently active alternative, throw an exception of type `bad&lowbar;variant&lowbar;access`&period; `t&lowbar;TYPE` shall appear exactly once in the variant&apos;s list of alternatives&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class t&lowbar;TYPE,
    class t&lowbar;HEAD,
    class&period;&period;&period; t&lowbar;TAIL&gt;
t&lowbar;TYPE&
get(xref:bsl/variant.adoc[variant&lt;t&lowbar;HEAD, t&lowbar;TAIL&period;&period;&period;&gt;]& obj);
----


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