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

Create a managed pointer that takes ownership of the object managed by the specified `alias`, but which uses the specified `ptr` to refer to its target object, unless `0 &equals;&equals; ptr`, in which case create an empty managed pointer&period; Reset `alias` to empty if ownership of its managed object is transferred&period; The behavior is undefined if `alias` is empty, but `0 !&equals; ptr`&period; Note that destroying or re&hyphen;assigning a managed pointer created with this constructor will destroy the object originally managed by `alias` (unless `release` is called first)&semi; the destructor for `&ast;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;
ManagedPtr(
    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]#
