[#BloombergLP-bslma-ManagedPtr-0fa-load-0e]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[ManagedPtr]::load
:relfileprefix: ../../../
:mrdocs:

Destroy the currently managed object, if any&period; Then, set the target object of this managed pointer to be that referenced by the specified `ptr`, take ownership of `&ast;ptr` as the currently managed object, and set a deleter that uses the currently installed default allocator to destroy the managed object when invoked (e&period;g&period;, when this managed pointer object is destroyed), unless `0 &equals;&equals; ptr`, in which case reset this managed pointer to empty&period; The deleter will invoke the destructor of `MANAGED&lowbar;TYPE` rather than the destructor of `TARGET&lowbar;TYPE`&period; This function will not compile unless `MANAGED&lowbar;TYPE &ast;` is convertible to `TARGET&lowbar;TYPE &ast;`&period; The behavior is undefined unless the managed object (if any) can be destroyed by the currently installed default allocator, or if the lifetime of the managed object is already managed by another object&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class MANAGED&lowbar;TYPE&gt;
void
load(MANAGED&lowbar;TYPE* ptr);
----


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