[#BloombergLP-bslma-ManagedPtr-0fa-2constructor-083] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[ManagedPtr]::ManagedPtr :relfileprefix: ../../../ :mrdocs: Create a managed pointer having a target object referenced by the specified `ptr`, owning the managed object `*ptr`, and having a deleter that will call `delete ptr` to destroy the managed object when invoked (e.g., when this managed pointer object is destroyed), unless `0 == ptr`, in which case create an empty managed pointer. The deleter will invoke the destructor of `MANAGED_TYPE` rather than the destructor of `TARGET_TYPE`. This constructor will not compile unless `MANAGED_TYPE *` is convertible to `TARGET_TYPE *`. Note that this behavior allows `ManagedPtr` to be defined for `void` pointers, and to call the correct destructor for the managed object, even if the destructor for `TARGET_TYPE` is not declared as `virtual`. The behavior is undefined unless the managed object (if any) can be destroyed by `delete`, or if the lifetime of the managed object is already managed by another object. == Synopsis Declared in `<bslma_managedptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class MANAGED_TYPE> explicit ManagedPtr(MANAGED_TYPE* ptr); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#