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

Create an `optional` object whose contained value is initialized by forwarding from the specified `value`&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 = t&lowbar;TYPE&gt;
explicit
optional(
    std::allocator&lowbar;arg&lowbar;t allocatorArg,
    xref:bsl/optional-072.adoc[AllocType] allocator,
    t&lowbar;ANY&lowbar;TYPE&& value);
----

== Description

Create an `optional` object whose contained value is initialized by forwarding from the specified `value`&period; Use the specified `allocator` to supply memory&period; Note that this constructor participates in overload resolution only when `t&lowbar;TYPE` is constructible from `t&lowbar;ANY&lowbar;TYPE`, and is explicit only when `t&lowbar;ANY&lowbar;TYPE` is not 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
| *value*
| value compared with or used to initialize the optional
|===


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