[#BloombergLP-bslmf-Switch-07a1]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmf.adoc[bslmf]::Switch
:relfileprefix: ../../
:mrdocs:

Compile&hyphen;time type switch among a variable number of types&period;

== Synopsis

Declared in `&lt;bslmf&lowbar;switch&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    size&lowbar;t t&lowbar;SWITCH&lowbar;SELECTOR,
    class&period;&period;&period; t&lowbar;TYPES&gt;
struct Switch;
----

== Description

This meta&hyphen;function, parameterized by an integral `t&lowbar;SWITCH&lowbar;SELECTOR` and types `t&lowbar;T0` up to `t&lowbar;T9`, provides a single type alias, `Type`, which resolves, through specialization for a particular value `N` of `t&lowbar;SWITCH&lowbar;SELECTOR`, to the type `TN`, or to `Nil` if `t&lowbar;SWITCH&lowbar;SELECTOR` is negative or larger than the number of template arguments provided for the types&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmf/Switch-07a1/Type.adoc[`Type`] 
| Alias to the type selected by `t&lowbar;SWITCH&lowbar;SELECTOR`, or `Nil`&period;
|===


== Specializations

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmf/Switch-04a.adoc[`Switch&lt;0U, t&lowbar;T0, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| This specialization of `Switch` for a value of 0 of the parameterized `t&lowbar;SWITCH&lowbar;SELECTOR` selects the parameterized `t&lowbar;T0` as `Type`&period;
| xref:BloombergLP/bslmf/Switch-058.adoc[`Switch&lt;1U, t&lowbar;T0, t&lowbar;T1, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| This specialization of `Switch` for a value of 1 of the parameterized `t&lowbar;SWITCH&lowbar;SELECTOR` selects the parameterized `t&lowbar;T1` as `Type`&period;
| xref:BloombergLP/bslmf/Switch-051.adoc[`Switch&lt;2U, t&lowbar;T0, t&lowbar;T1, t&lowbar;T2, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| This specialization of `Switch` for a value of 2 of the parameterized `t&lowbar;SWITCH&lowbar;SELECTOR` selects the parameterized `t&lowbar;T2` as `Type`&period;
| xref:BloombergLP/bslmf/Switch-04e.adoc[`Switch&lt;3U, t&lowbar;T0, t&lowbar;T1, t&lowbar;T2, t&lowbar;T3, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| This specialization of `Switch` for a value of 3 of the parameterized `t&lowbar;SWITCH&lowbar;SELECTOR` selects the parameterized `t&lowbar;T3` as `Type`&period;
| xref:BloombergLP/bslmf/Switch-0c.adoc[`Switch&lt;4U, t&lowbar;T0, t&lowbar;T1, t&lowbar;T2, t&lowbar;T3, t&lowbar;T4, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| This specialization of `Switch` for a value of 4 of the parameterized `t&lowbar;SWITCH&lowbar;SELECTOR` selects the parameterized `t&lowbar;T4` as `Type`&period;
| xref:BloombergLP/bslmf/Switch-0b.adoc[`Switch&lt;5U, t&lowbar;T0, t&lowbar;T1, t&lowbar;T2, t&lowbar;T3, t&lowbar;T4, t&lowbar;T5, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| This specialization of `Switch` for a value of 5 of the parameterized `t&lowbar;SWITCH&lowbar;SELECTOR` selects the parameterized `t&lowbar;T5` as `Type`&period;
| xref:BloombergLP/bslmf/Switch-0a.adoc[`Switch&lt;6U, t&lowbar;T0, t&lowbar;T1, t&lowbar;T2, t&lowbar;T3, t&lowbar;T4, t&lowbar;T5, t&lowbar;T6, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| This specialization of `Switch` for a value of 6 of the parameterized `t&lowbar;SWITCH&lowbar;SELECTOR` selects the parameterized `t&lowbar;T6` as `Type`&period;
| xref:BloombergLP/bslmf/Switch-00.adoc[`Switch&lt;7U, t&lowbar;T0, t&lowbar;T1, t&lowbar;T2, t&lowbar;T3, t&lowbar;T4, t&lowbar;T5, t&lowbar;T6, t&lowbar;T7, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| This specialization of `Switch` for a value of 7 of the parameterized `t&lowbar;SWITCH&lowbar;SELECTOR` selects the parameterized `t&lowbar;T7` as `Type`&period;
| xref:BloombergLP/bslmf/Switch-07c.adoc[`Switch&lt;8U, t&lowbar;T0, t&lowbar;T1, t&lowbar;T2, t&lowbar;T3, t&lowbar;T4, t&lowbar;T5, t&lowbar;T6, t&lowbar;T7, t&lowbar;T8, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| This specialization of `Switch` for a value of 8 of the parameterized `t&lowbar;SWITCH&lowbar;SELECTOR` selects the parameterized `t&lowbar;T8` as `Type`&period;
| xref:BloombergLP/bslmf/Switch-07a7.adoc[`Switch&lt;9U, t&lowbar;T0, t&lowbar;T1, t&lowbar;T2, t&lowbar;T3, t&lowbar;T4, t&lowbar;T5, t&lowbar;T6, t&lowbar;T7, t&lowbar;T8, t&lowbar;T9, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| This specialization of `Switch` for a value of 9 of the parameterized `t&lowbar;SWITCH&lowbar;SELECTOR` selects the parameterized `t&lowbar;T9` as `Type`&period;
| xref:BloombergLP/bslmf/Switch-0d.adoc[`Switch&lt;t&lowbar;SWITCH&lowbar;SELECTOR, t&lowbar;T0, t&lowbar;T1, t&lowbar;T2, t&lowbar;T3, t&lowbar;T4, t&lowbar;T5, t&lowbar;T6, t&lowbar;T7, t&lowbar;T8, t&lowbar;T9, t&lowbar;T10, t&lowbar;TYPES&period;&period;&period;&gt;`] 
| Recursing specialization of `Switch` for selectors of 10 or greater&period;
|===



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