[#bsl-allocate_shared_for_overwrite-05]
= xref:bsl.adoc[bsl]::allocate&lowbar;shared&lowbar;for&lowbar;overwrite
: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_for_overwrite-0d.adoc[allocate&lowbar;shared&lowbar;for&lowbar;overwrite](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_for_overwrite-0d.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&gt;
xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;ELEMENT&lowbar;TYPE&gt;]
xref:bsl/allocate_shared_for_overwrite-07.adoc[allocate&lowbar;shared&lowbar;for&lowbar;overwrite](ALLOC basicAllocator)
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_for_overwrite-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_for_overwrite-017.adoc[allocate&lowbar;shared&lowbar;for&lowbar;overwrite](ALLOC* basicAllocator)
requires is&lowbar;bounded&lowbar;array&lt;ARRAY&lowbar;TYPE&gt;&colon;&colon;value;
----

[.small]#xref:bsl/allocate_shared_for_overwrite-017.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&gt;
xref:bsl/shared_ptr-0a.adoc[bsl::shared&lowbar;ptr&lt;ELEMENT&lowbar;TYPE&gt;]
xref:bsl/allocate_shared_for_overwrite-01c.adoc[allocate&lowbar;shared&lowbar;for&lowbar;overwrite](ALLOC* basicAllocator)
requires !is&lowbar;array&lt;ELEMENT&lowbar;TYPE&gt;&colon;&colon;value;
----

[.small]#xref:bsl/allocate_shared_for_overwrite-01c.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_for_overwrite-0eed.adoc[allocate&lowbar;shared&lowbar;for&lowbar;overwrite](
    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_for_overwrite-0eed.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_for_overwrite-0ee2.adoc[allocate&lowbar;shared&lowbar;for&lowbar;overwrite](
    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_for_overwrite-0ee2.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
|===


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