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

If the specified `alias` manages the same object as this managed pointer, set the target object of this managed pointer to be that referenced by the specified `ptr`&semi; otherwise, destroy the currently managed object (if any), and if `alias` is empty, reset this managed pointer to empty&semi; otherwise, transfer ownership (and the deleter) of the object managed by `alias`, and set the target object of this managed pointer to be that referenced by `ptr`&period; The behavior is undefined if `0 &equals;&equals; ptr` and `alias` is not empty, or if `0 !&equals; ptr` and `alias` is empty, or if `ptr` is already managed by a managed pointer other than `alias`&period; Note that this establishes a managed pointer where `ptr` aliases `alias`&period; The managed object for `alias` will ultimately be destroyed, and the destructor for `ptr` is not called directly&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALIASED&lowbar;TYPE&gt;
void
loadAlias(
    xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[ManagedPtr&lt;ALIASED&lowbar;TYPE&gt;]& alias,
    TARGET&lowbar;TYPE* ptr);
----


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