[#BloombergLP-bdlb-Variant-2constructor-035] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/Variant.adoc[Variant]::Variant :relfileprefix: ../../../ :mrdocs: Constructors == Synopses Declared in `<bdlb_variant.h>` Create a variant object in the unset state that uses the currently installed default allocator to supply memory. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlb/Variant/2constructor-0a.adoc[Variant](); ---- [.small]#xref:BloombergLP/bdlb/Variant/2constructor-0a.adoc[_» more..._]# Create a variant by moving from `original`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlb/Variant/2constructor-038.adoc[Variant](xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<Variant>] original); ---- [.small]#xref:BloombergLP/bdlb/Variant/2constructor-038.adoc[_» more..._]# Create a variant from `valueOrAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE_OR_ALLOCATOR> explicit xref:BloombergLP/bdlb/Variant/2constructor-0d.adoc[Variant](TYPE_OR_ALLOCATOR const& valueOrAllocator); ---- [.small]#xref:BloombergLP/bdlb/Variant/2constructor-0d.adoc[_» more..._]# Create a variant by moving from the specified `value`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> explicit xref:BloombergLP/bdlb/Variant/2constructor-04.adoc[Variant](TYPE&& value) requires !bsl::is_same< SelfType, typename bsl::remove_const< typename bsl::remove_reference<TYPE>::type>::type>::value && !bsl::is_convertible<TYPE, bslma::Allocator *>::value; ---- [.small]#xref:BloombergLP/bdlb/Variant/2constructor-04.adoc[_» more..._]# Create a variant holding `value` using `basicAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> xref:BloombergLP/bdlb/Variant/2constructor-09.adoc[Variant](TYPE&& value) requires !bsl::is_same< SelfType, typename bsl::remove_const< typename bsl::remove_reference<TYPE>::type>::type>::value; ---- [.small]#xref:BloombergLP/bdlb/Variant/2constructor-09.adoc[_» more..._]# Create a variant from `original` using `basicAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlb/Variant/2constructor-05.adoc[Variant]( xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<Variant>] original, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator); ---- [.small]#xref:BloombergLP/bdlb/Variant/2constructor-05.adoc[_» more..._]# Create a variant with the type and value of `original`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlb/Variant/2constructor-02.adoc[Variant]( xref:BloombergLP/bdlb/Variant.adoc[Variant] const& original, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0); ---- [.small]#xref:BloombergLP/bdlb/Variant/2constructor-02.adoc[_» more..._]# Create a variant holding `value` using `basicAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> xref:BloombergLP/bdlb/Variant/2constructor-0b.adoc[Variant]( TYPE const& value, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator); ---- [.small]#xref:BloombergLP/bdlb/Variant/2constructor-0b.adoc[_» more..._]# == Parameters [cols="1,4"] |=== | Name| Description | *original* | source variant to copy or move from | *valueOrAllocator* | held value, or allocator if convertible to `bslma::Allocator *` | *value* | value assigned to or stored in this variant | *basicAllocator* | allocator used to supply memory |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#