[#bsl-Variant_VariantAlternativeImpl-06e]
= xref:bsl.adoc[bsl]::Variant&lowbar;VariantAlternativeImpl
:relfileprefix: ../
:mrdocs:

This component&hyphen;private metafunction provides the implementation of `bsl&colon;&colon;variant&lowbar;alternative`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    std::size&lowbar;t t&lowbar;INDEX,
    class t&lowbar;HEAD = BSLSTL&lowbar;VARIANT&lowbar;NOT&lowbar;A&lowbar;TYPE,
    class&period;&period;&period; t&lowbar;TAIL&gt;
struct Variant&lowbar;VariantAlternativeImpl
    : Variant&lowbar;VariantAlternativeImpl&lt;t&lowbar;INDEX &hyphen; 1, t&lowbar;TAIL&period;&period;&period;&gt;
----

== Description

It recursively strips one type from the front of (template parameters) `t&lowbar;HEAD, t&lowbar;TAIL&period;&period;&period;` for each decrement of (template parameter) `t&lowbar;INDEX` until `t&lowbar;INDEX` reaches `0`, at which point the resulting `t&lowbar;HEAD` is the alternative type&period;

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `Variant&lowbar;VariantAlternativeImpl&lt;t&lowbar;INDEX &hyphen; 1, t&lowbar;TAIL&period;&period;&period;&gt;`
| This component&hyphen;private metafunction provides the implementation of `bsl&colon;&colon;variant&lowbar;alternative`&period;
|===

== Specializations

[cols="1,4"]
|===
| Name| Description
| xref:bsl/Variant_VariantAlternativeImpl-00.adoc[`Variant&lowbar;VariantAlternativeImpl&lt;0, BSLSTL&lowbar;VARIANT&lowbar;NOT&lowbar;A&lowbar;TYPE&gt;`] 
| This explicit specialization handles the case of an empty alternative list queried at index `0`&period; No member typedef is provided&period;
| xref:bsl/Variant_VariantAlternativeImpl-04.adoc[`Variant&lowbar;VariantAlternativeImpl&lt;t&lowbar;INDEX, BSLSTL&lowbar;VARIANT&lowbar;NOT&lowbar;A&lowbar;TYPE&gt;`] 
| This partial specialization is used when the list of alternatives is exhausted before `t&lowbar;INDEX` reaches `0`, i&period;e&period;, `t&lowbar;INDEX` is out of range&period;
| xref:bsl/Variant_VariantAlternativeImpl-069.adoc[`Variant&lowbar;VariantAlternativeImpl&lt;0, t&lowbar;HEAD, t&lowbar;TAIL&period;&period;&period;&gt;`] 
| This partial specialization is the base case of the recursion, reached when `t&lowbar;INDEX` is `0`&semi; it provides the member typedef `type` equal to `t&lowbar;HEAD`&period;
|===


== Derived Classes

[cols="1,4"]
|===
| Name| Description
| `Variant&lowbar;VariantAlternativeImpl` 
| This component&hyphen;private metafunction provides the implementation of `bsl&colon;&colon;variant&lowbar;alternative`&period;
| xref:bsl/variant_alternative-06.adoc[`variant&lowbar;alternative&lt;t&lowbar;INDEX, variant&lt;t&lowbar;HEAD, t&lowbar;TAIL&period;&period;&period;&gt;&gt;`] 
| Compute the alternative type at index `t&lowbar;INDEX` of a `bsl&colon;&colon;variant`&period;
|===


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