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

Return a `shared&lowbar;ptr` managing a newly created object&period;

== Synopses

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

Return a `shared&lowbar;ptr` managing a newly created object&period;


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

[.small]#xref:bsl/allocate_shared-0f.adoc[_» more&period;&period;&period;_]#

Return a `shared&lowbar;ptr` managing a newly created object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ARRAY&lowbar;TYPE,
    class ALLOC&gt;
xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;ARRAY&lowbar;TYPE&gt;]
xref:bsl/allocate_shared-08.adoc[allocate&lowbar;shared](ALLOC* basicAllocator)
requires is&lowbar;bounded&lowbar;array&lt;ARRAY&lowbar;TYPE&gt;&colon;&colon;value;
----

[.small]#xref:bsl/allocate_shared-08.adoc[_» more&period;&period;&period;_]#

Return a `shared&lowbar;ptr` managing a newly created object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ARRAY&lowbar;TYPE,
    class ALLOC&gt;
xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;ARRAY&lowbar;TYPE&gt;]
xref:bsl/allocate_shared-07.adoc[allocate&lowbar;shared](
    ALLOC basicAllocator,
    std::size&lowbar;t numElements)
requires is&lowbar;unbounded&lowbar;array&lt;ARRAY&lowbar;TYPE&gt;&colon;&colon;value &amp;&amp;
                                                     !is&lowbar;pointer&lt;ALLOC&gt;&colon;&colon;value;
----

[.small]#xref:bsl/allocate_shared-07.adoc[_» more&period;&period;&period;_]#

Return a `shared&lowbar;ptr` managing a newly created object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ARRAY&lowbar;TYPE,
    class ALLOC&gt;
xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;ARRAY&lowbar;TYPE&gt;]
xref:bsl/allocate_shared-05d.adoc[allocate&lowbar;shared](
    ALLOC basicAllocator,
    remove&lowbar;extent&lt;ARRAY&lowbar;TYPE&gt;::type const& value)
requires is&lowbar;bounded&lowbar;array&lt;ARRAY&lowbar;TYPE&gt;&colon;&colon;value &amp;&amp;
                                                     !is&lowbar;pointer&lt;ALLOC&gt;&colon;&colon;value;
----

[.small]#xref:bsl/allocate_shared-05d.adoc[_» more&period;&period;&period;_]#

Return a `shared&lowbar;ptr` managing a newly created object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ARRAY&lowbar;TYPE,
    class ALLOC&gt;
xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;ARRAY&lowbar;TYPE&gt;]
xref:bsl/allocate_shared-05b.adoc[allocate&lowbar;shared](
    ALLOC* basicAllocator,
    std::size&lowbar;t numElements)
requires is&lowbar;unbounded&lowbar;array&lt;ARRAY&lowbar;TYPE&gt;&colon;&colon;value;
----

[.small]#xref:bsl/allocate_shared-05b.adoc[_» more&period;&period;&period;_]#

Return a `shared&lowbar;ptr` managing a newly created object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ARRAY&lowbar;TYPE,
    class ALLOC&gt;
xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;ARRAY&lowbar;TYPE&gt;]
xref:bsl/allocate_shared-0c.adoc[allocate&lowbar;shared](
    ALLOC* basicAllocator,
    remove&lowbar;extent&lt;ARRAY&lowbar;TYPE&gt;::type const& value)
requires is&lowbar;bounded&lowbar;array&lt;ARRAY&lowbar;TYPE&gt;&colon;&colon;value;
----

[.small]#xref:bsl/allocate_shared-0c.adoc[_» more&period;&period;&period;_]#

Return a `shared&lowbar;ptr` managing a newly created object&period;


[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;]
xref:bsl/allocate_shared-01e.adoc[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]#xref:bsl/allocate_shared-01e.adoc[_» more&period;&period;&period;_]#

Return a `shared&lowbar;ptr` managing a newly created object&period;


[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;]
xref:bsl/allocate_shared-0bb.adoc[allocate&lowbar;shared](
    ALLOC* basicAllocator,
    ARGS&&&period;&period;&period; args)
requires !is&lowbar;array&lt;ELEMENT&lowbar;TYPE&gt;&colon;&colon;value;
----

[.small]#xref:bsl/allocate_shared-0bb.adoc[_» more&period;&period;&period;_]#

Return a `shared&lowbar;ptr` managing a newly created object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ARRAY&lowbar;TYPE,
    class ALLOC&gt;
xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;ARRAY&lowbar;TYPE&gt;]
xref:bsl/allocate_shared-01f.adoc[allocate&lowbar;shared](
    ALLOC basicAllocator,
    std::size&lowbar;t numElements,
    remove&lowbar;extent&lt;ARRAY&lowbar;TYPE&gt;::type const& value)
requires is&lowbar;unbounded&lowbar;array&lt;ARRAY&lowbar;TYPE&gt;&colon;&colon;value &amp;&amp;
                                                     !is&lowbar;pointer&lt;ALLOC&gt;&colon;&colon;value;
----

[.small]#xref:bsl/allocate_shared-01f.adoc[_» more&period;&period;&period;_]#

Return a `shared&lowbar;ptr` managing a newly created object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ARRAY&lowbar;TYPE,
    class ALLOC&gt;
xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;ARRAY&lowbar;TYPE&gt;]
xref:bsl/allocate_shared-04.adoc[allocate&lowbar;shared](
    ALLOC* basicAllocator,
    std::size&lowbar;t numElements,
    remove&lowbar;extent&lt;ARRAY&lowbar;TYPE&gt;::type const& value)
requires is&lowbar;unbounded&lowbar;array&lt;ARRAY&lowbar;TYPE&gt;&colon;&colon;value;
----

[.small]#xref:bsl/allocate_shared-04.adoc[_» more&period;&period;&period;_]#

== Return Value

shared pointer managing a newly created object

== Parameters

[cols="1,4"]
|===
| Name| Description
| *basicAllocator*
| allocator used to supply memory
| *numElements*
| number of elements in the unbounded array
| *value*
| value used to initialize each array element
| *args*
| constructor arguments forwarded to the new object
|===


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