[#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 == ptr`, in which case create an empty managed pointer. Reset `alias` to empty if ownership of its managed object is transferred. The behavior is undefined if `alias` is empty, but `0 != ptr`. Note that destroying or re‐assigning a managed pointer created with this constructor will destroy the object originally managed by `alias` (unless `release` is called first); the destructor for `*ptr` is not called directly. == Synopsis Declared in `<bslma_managedptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class ALIASED_TYPE> ManagedPtr( xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[ManagedPtr<ALIASED_TYPE>]& alias, TARGET_TYPE* ptr); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#