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

Create a managed pointer by taking ownership from `ref`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
ManagedPtr(xref:BloombergLP/bslma/ManagedPtr_Ref.adoc[ManagedPtr&lowbar;Ref&lt;TARGET&lowbar;TYPE&gt;] ref) noexcept;
----

== Description

Create a managed pointer having the same target object as the managed pointer referenced by the specified `ref`, transfer ownership of the managed object owned by the managed pointer referenced by `ref`, and reset the managed pointer referenced by `ref` to empty&period; This constructor is used to create a managed pointer from a managed pointer rvalue, or from a managed pointer to a &quot;compatible&quot; type, where &quot;compatible&quot; means a built&hyphen;in conversion from `COMPATIBLE&lowbar;TYPE &ast;` to `TARGET&lowbar;TYPE &ast;` is defined, e&period;g&period;, `derived &ast;` to `base &ast;`, `T &ast;` to `const T &ast;`, or `T &ast;` to `void &ast;`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ref*
| managed&hyphen;pointer reference from which to take ownership
|===


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