[#bsl-allocate_shared-01e]
= xref:bsl.adoc[bsl]::allocate&lowbar;shared
:relfileprefix: ../
:mrdocs:

Return a `shared&lowbar;ptr` object referring to and managing a new `ELEMENT&lowbar;TYPE` object&period; The specified `basicAllocator` will be used to supply a single contiguous region of memory holding the returned shared pointer&apos;s internal representation and the new `ELEMENT&lowbar;TYPE` object, which is initialized by calling `allocator&lowbar;traits&lt;ALLOC&gt;&colon;&colon;construct` passing `basicAllocator`, an `ELEMENT&lowbar;TYPE &ast;` pointer to space for the new shared object, and the specified arguments `std&colon;&colon;forward&lt;ARGS&gt;(args)&period;&period;&period;`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ELEMENT&lowbar;TYPE,
    class ALLOC,
    class&period;&period;&period; ARGS&gt;
xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;ELEMENT&lowbar;TYPE&gt;]
allocate&lowbar;shared(
    ALLOC basicAllocator,
    ARGS&&&period;&period;&period; args)
requires !is&lowbar;array&lt;ELEMENT&lowbar;TYPE&gt;&colon;&colon;value &amp;&amp; !is&lowbar;pointer&lt;ALLOC&gt;&colon;&colon;value;
----


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