[#BloombergLP-bslma-ManagedPtrUtil-allocateManaged-0e]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/ManagedPtrUtil.adoc[ManagedPtrUtil]::allocateManaged
:relfileprefix: ../../../
:mrdocs:

`allocateManaged` overloads

== Synopses

Declared in `&lt;bslma&lowbar;managedptr&period;h&gt;`

Create an object of the (template parameter) `ELEMENT&lowbar;TYPE` from the specified `args&period;&period;&period;` arguments, and return a `ManagedPtr` to manage the new object&period; Use the specified `allocator` to supply memory for the footprint of the new object and implicitly pass `allocator` as the allocator argument to the `ELEMENT&lowbar;TYPE` constructor if `bslma&colon;&colon;UsesBslmaAllocator&lt;ELEMENT&lowbar;TYPE&gt;&colon;&colon;value` is `true`&period; If `allocator` is a null pointer, the currently installed default allocator is used&period; Note that compilation will fail unless `allocator` is convertible to either `bslma&colon;&colon;Allocator &ast;` or `bsl&colon;&colon;allocator&lt;&gt;`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ELEMENT&lowbar;TYPE,
    class&period;&period;&period; ARGS&gt;
static
xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[ManagedPtr&lt;ELEMENT&lowbar;TYPE&gt;]
xref:BloombergLP/bslma/ManagedPtrUtil/allocateManaged-0f.adoc[allocateManaged](
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator,
    ARGS&&&period;&period;&period; args);
----

[.small]#xref:BloombergLP/bslma/ManagedPtrUtil/allocateManaged-0f.adoc[_» more&period;&period;&period;_]#

Same as the overload taking `bslma&colon;&colon;Allocator &ast;`, but accepts a class&hyphen;type `allocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ELEMENT&lowbar;TYPE,
    class ALLOCATOR,
    class&period;&period;&period; ARGS&gt;
static
xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[ManagedPtr&lt;ELEMENT&lowbar;TYPE&gt;]
xref:BloombergLP/bslma/ManagedPtrUtil/allocateManaged-06.adoc[allocateManaged](
    ALLOCATOR const& allocator,
    ARGS&&&period;&period;&period; args)
requires bsl&colon;&colon;is&lowbar;class&lt;ALLOCATOR&gt;&colon;&colon;value;
----

[.small]#xref:BloombergLP/bslma/ManagedPtrUtil/allocateManaged-06.adoc[_» more&period;&period;&period;_]#


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