[#BloombergLP-bslstl-Variant_Base]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::Variant&lowbar;Base
:relfileprefix: ../../
:mrdocs:

Define the data representation and special member functions of `bsl&colon;&colon;variant`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class t&lowbar;HEAD,
    class&period;&period;&period; t&lowbar;TAIL&gt;
struct Variant&lowbar;Base
    : xref:BloombergLP/bslstl/Variant_AllocatorBase-0e.adoc[BloombergLP::bslstl::Variant&lowbar;AllocatorBase&lt;BloombergLP&colon;&colon;bslstl&colon;&colon;Variant&lowbar;UsesBslmaAllocatorAny&lt;t&lowbar;HEAD, t&lowbar;TAIL&period;&period;&period;&gt;&colon;&colon;value&gt;]
----

== Description

This component&hyphen;private struct defines the data representation of `bsl&colon;&colon;variant` and contains the implementations of its special member functions (which must be defaulted in `bsl&colon;&colon;variant` itself)&period;

This class also contains implementations of additional constructors and methods needed for the correct functionality of the `variant` class hierarchy&period;

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bslstl/Variant_AllocatorBase-0e.adoc[BloombergLP::bslstl::Variant&lowbar;AllocatorBase&lt;BloombergLP&colon;&colon;bslstl&colon;&colon;Variant&lowbar;UsesBslmaAllocatorAny&lt;t&lowbar;HEAD, t&lowbar;TAIL&period;&period;&period;&gt;&colon;&colon;value&gt;]`
| This component&hyphen;private struct keeps track of the allocator for a `bsl&colon;&colon;variant` object&period;
|===

== Types

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/Variant_Base/NoAlloc.adoc[`NoAlloc`] 
| This trivial tag type is used as a dummy when `Variant&lowbar;Base` wraps a non&hyphen;allocator&hyphen;aware type&period;
|===


== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/Variant_Base/AllocBase.adoc[`AllocBase`] 
| Base class providing allocator support when needed&period;
| xref:BloombergLP/bslstl/Variant_Base/MoveUtil.adoc[`MoveUtil`] 
| Utility for movable reference operations&period;
| xref:BloombergLP/bslstl/Variant_Base/Variant.adoc[`Variant`] 
| Corresponding public `bsl&colon;&colon;variant` type&period;
| xref:BloombergLP/bslstl/Variant_Base/Variant_Union.adoc[`Variant&lowbar;Union`] 
| Union holding the active alternative objects&period;
| xref:BloombergLP/bslstl/Variant_Base/allocator_type.adoc[`allocator&lowbar;type`] 
| Type alias to the allocator type used by `variant`&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/Variant_Base/2constructor-08d.adoc[`Variant&lowbar;Base`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bslstl/Variant_Base/2destructor.adoc[`&#126;Variant&lowbar;Base`] [.small]#[destructor]#
| Destroy this object&period; The contained value, if any, is destroyed&period;
| xref:BloombergLP/bslstl/Variant_Base/operator_assign-06.adoc[`operator&equals;`] 
| Assignment operators
| xref:BloombergLP/bslstl/Variant_Base/baseEmplace.adoc[`baseEmplace`] 
| Create the alternative with index (template parameter) `t&lowbar;INDEX` in place, direct&hyphen;initialized from the specified `args`&period;
| xref:BloombergLP/bslstl/Variant_AllocatorBase-0e/mechanism.adoc[`mechanism`] 
| Return a null pointer&period;
| xref:BloombergLP/bslstl/Variant_Base/reset.adoc[`reset`] 
| Destroy the contained value, if any&period;
| xref:BloombergLP/bslstl/Variant_Base/2conversion-0e.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;Variant&lowbar;Base, IsBitwiseMoveable, (BloombergLP&colon;&colon;bslstl&colon;&colon;Variant&lowbar;IsBitwiseMoveableAll&lt;t&lowbar;HEAD, t&lowbar;TAIL&period;&period;&period;&gt;&colon;&colon;value)&gt;`] 
| Nested trait declaration for `IsBitwiseMoveable`&period;
| xref:BloombergLP/bslstl/Variant_Base/2conversion-03.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;Variant&lowbar;Base, UsesAllocatorArgT, (BloombergLP&colon;&colon;bslstl&colon;&colon;Variant&lowbar;UsesBslmaAllocatorAny&lt;t&lowbar;HEAD, t&lowbar;TAIL&period;&period;&period;&gt;&colon;&colon;value)&gt;`] 
| Nested trait declaration for `UsesAllocatorArgT`&period;
| xref:BloombergLP/bslstl/Variant_Base/2conversion-0f.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;Variant&lowbar;Base, UsesBslmaAllocator, (BloombergLP&colon;&colon;bslstl&colon;&colon;Variant&lowbar;UsesBslmaAllocatorAny&lt;t&lowbar;HEAD, t&lowbar;TAIL&period;&period;&period;&gt;&colon;&colon;value)&gt;`] 
| Nested trait declaration for `UsesBslmaAllocator`&period;
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/Variant_Base/d_type.adoc[`d&lowbar;type`] 
| Index of the currently active alternative in this variant object, or `bsl&colon;&colon;variant&lowbar;npos` if the variant is valueless by exception&period;
| xref:BloombergLP/bslstl/Variant_Base/d_union.adoc[`d&lowbar;union`] 
| Union holding the alternative object&period;
|===



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