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

Assign ownership from compatible `rhs` to this managed pointer&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[ManagedPtr&lt;TARGET&lowbar;TYPE&gt;]&
operator&equals;(xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[ManagedPtr&lt;BDE&lowbar;OTHER&lowbar;TYPE&gt;]&& rhs) noexcept
requires bsl&colon;&colon;is&lowbar;convertible&lt;BDE&lowbar;OTHER&lowbar;TYPE &ast;, TARGET&lowbar;TYPE &ast;&gt;&colon;&colon;value;
----

== Description

If this object and the specified `rhs` 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 `rhs` to this managed pointer, set this managed pointer to point to the target object referenced by `rhs`, reset `rhs` to empty, and return a reference to this managed pointer&period; `TARGET&lowbar;TYPE` must be an accessible and unambiguous base of `BDE&lowbar;OTHER&lowbar;TYPE`&period;

== Return Value

reference to this managed pointer

== Parameters

[cols="1,4"]
|===
| Name| Description
| *rhs*
| compatible managed pointer from which to take ownership
|===


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