[#BloombergLP-bslma-ManagedPtr-0fa-operator_assign-0b]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[ManagedPtr]::operator&equals;
:relfileprefix: ../../../
:mrdocs:

Assign ownership from the managed pointer referenced by `ref`&period;

== Synopsis

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

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

== Description

If this object and the managed pointer reference by the specified `ref` manage the same object, return a reference to this managed pointer&semi; otherwise, destroy the managed object owned by this managed pointer, transfer ownership of the managed object owned by the managed pointer referenced by `ref`, and set this managed pointer to point to the target object currently referenced the managed pointer referenced by `ref`&semi; then reset the managed pointer referenced by `ref` to empty, and return a reference to this managed pointer&period; This operator is (implicitly) used to assign 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 `MANAGED&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;

== Return Value

reference to this managed pointer

== Parameters

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


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