[#BloombergLP-bdlb-Variant12-2constructor-082] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/Variant12.adoc[Variant12]::Variant12 :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/Variant12/2constructor-00.adoc[Variant12](); ---- [.small]#xref:BloombergLP/bdlb/Variant12/2constructor-00.adoc[_» more..._]# Create a variant by moving from `original`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlb/Variant12/2constructor-08e.adoc[Variant12](xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<Variant12>] original); ---- [.small]#xref:BloombergLP/bdlb/Variant12/2constructor-08e.adoc[_» more..._]# Create a variant from `valueOrAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE_OR_ALLOCATOR> explicit xref:BloombergLP/bdlb/Variant12/2constructor-06.adoc[Variant12](TYPE_OR_ALLOCATOR const& valueOrAllocator); ---- [.small]#xref:BloombergLP/bdlb/Variant12/2constructor-06.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/Variant12/2constructor-07.adoc[Variant12](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/Variant12/2constructor-07.adoc[_» more..._]# Create a variant holding `value` using `basicAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> xref:BloombergLP/bdlb/Variant12/2constructor-02.adoc[Variant12](TYPE&& value) requires !bsl::is_same< SelfType, typename bsl::remove_const< typename bsl::remove_reference<TYPE>::type>::type>::value; ---- [.small]#xref:BloombergLP/bdlb/Variant12/2constructor-02.adoc[_» more..._]# Create a variant from `original` using `basicAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlb/Variant12/2constructor-0e.adoc[Variant12]( xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef<Variant12>] original, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator); ---- [.small]#xref:BloombergLP/bdlb/Variant12/2constructor-0e.adoc[_» more..._]# Create a variant with the type and value of `original`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlb/Variant12/2constructor-0d.adoc[Variant12]( xref:BloombergLP/bdlb/Variant12.adoc[Variant12] const& original, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0); ---- [.small]#xref:BloombergLP/bdlb/Variant12/2constructor-0d.adoc[_» more..._]# Create a variant holding `value` using `basicAllocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> xref:BloombergLP/bdlb/Variant12/2constructor-03.adoc[Variant12]( TYPE const& value, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator); ---- [.small]#xref:BloombergLP/bdlb/Variant12/2constructor-03.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]#