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