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