[#BloombergLP-bslmf-SelectTrait]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmf.adoc[bslmf]::SelectTrait
:relfileprefix: ../../
:mrdocs:

Metafunction that selects the first matching trait for a type&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class t&lowbar;TYPE,
    template&lt;class&gt; typename t&lowbar;TRAIT1,
    template&lt;class&gt; typename t&lowbar;TRAIT2 = SelectTrait&lowbar;False,
    template&lt;class&gt; typename t&lowbar;TRAIT3 = SelectTrait&lowbar;False,
    template&lt;class&gt; typename t&lowbar;TRAIT4 = SelectTrait&lowbar;False,
    template&lt;class&gt; typename t&lowbar;TRAIT5 = SelectTrait&lowbar;False,
    template&lt;class&gt; typename t&lowbar;TRAIT6 = SelectTrait&lowbar;False,
    template&lt;class&gt; typename t&lowbar;TRAIT7 = SelectTrait&lowbar;False,
    template&lt;class&gt; typename t&lowbar;TRAIT8 = SelectTrait&lowbar;False,
    template&lt;class&gt; typename t&lowbar;TRAIT9 = SelectTrait&lowbar;False&gt;
struct SelectTrait
    : &sol;&ast; implementation-defined &ast;&sol;::Type
----

== Description

Instantiate each specified (template parameter) `t&lowbar;TRAIT1` to `t&lowbar;TRAIT9` metafunction using the specified (template parameter) `t&lowbar;TYPE`&period; Inherit from `SelectTraitCase&lt;TRAITx&gt;`, where _x_ is `1` if `t&lowbar;TRAIT1&lt;t&lowbar;TYPE&gt;&colon;&colon;value` is true, `2` if `t&lowbar;TRAIT2&lt;t&lowbar;TYPE&gt;&colon;&colon;value` is true, etc&period;&period; If none of the traits evaluates to true, then inherit from `SelectTraitCase&lt;&gt;`, which means that none of the traits match&period;

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `&sol;&ast; implementation-defined &ast;&sol;::Type`
| 
|===

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmf/SelectTrait/OrdinalType.adoc[`OrdinalType`] 
| `OrdinalType` is an integral constant holding the selected trait ordinal&period;
|===


== Enums

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslmf/SelectTrait/_04enum.adoc[`Unnamed enum`] 
| Index of the selected trait ordinal&period;
|===



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