[#BloombergLP-bslstl-Optional_DataImp-emplace-03]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/Optional_DataImp.adoc[Optional&lowbar;DataImp]::emplace
:relfileprefix: ../../../
:mrdocs:

Destroy any contained value and construct a new one in place&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class t&lowbar;INIT&lowbar;LIST&lowbar;TYPE,
    class&period;&period;&period; t&lowbar;ARGS&gt;
t&lowbar;TYPE&
emplace(
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator,
    std::initializer&lowbar;list&lt;t&lowbar;INIT&lowbar;LIST&lowbar;TYPE&gt; initializer&lowbar;list,
    t&lowbar;ARGS&&&period;&period;&period; args);
----

== Description

Create an object of `StoredType` in `d&lowbar;buffer` using the specified `allocator`, `initializer&lowbar;list`, and `args`, and return a reference providing modifiable access to the underlying `t&lowbar;TYPE` object&period;

== Return Value

reference providing modifiable access to the contained value

== Parameters

[cols="1,4"]
|===
| Name| Description
| *allocator*
| allocator used to supply memory
| *initializer&lowbar;list*
| initializer list forwarded to construct the contained value
| *args*
| arguments forwarded to construct the contained value
|===


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