[#bsl-optional-072-2constructor-00e]
= xref:bsl.adoc[bsl]::xref:bsl/optional-072.adoc[optional]::optional
:relfileprefix: ../../
:mrdocs:

Create a disengaged `optional` object if the specified `original` object is disengaged, and an `optional` object with the value of `original&period;value()` moved&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;ANY&lowbar;TYPE&gt;
optional(
    std::allocator&lowbar;arg&lowbar;t allocatorArg,
    xref:bsl/optional-072.adoc[AllocType] allocator,
    xref:BloombergLP/bslmf/MovableRef_Deduced.adoc[BloombergLP::bslmf::MovableRef&lowbar;Deduced&lt;optional&lt;t&lowbar;ANY&lowbar;TYPE&gt;&gt;] original);
----

== Description

Create a disengaged `optional` object if the specified `original` object is disengaged, and an `optional` object with the value of `original&period;value()` moved and

Create a disengaged `optional` object if the specified `original` object is disengaged, and an `optional` object with the value of `original&period;value()` moved and converted to `t&lowbar;TYPE` otherwise&period; Use the specified `allocator` to supply memory&period; `original` is left in a valid but unspecified state&period; Note that this constructor participates in overload resolution only when `t&lowbar;TYPE` is constructible from an xvalue of `t&lowbar;ANY&lowbar;TYPE`, and is implicit only when an xvalue of `t&lowbar;ANY&lowbar;TYPE` is implicitly convertible to `t&lowbar;TYPE`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *allocatorArg*
| tag selecting the allocator&hyphen;extended constructor
| *allocator*
| allocator used to supply memory
| *original*
| source optional used to initialize this object
|===


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