[#bsl-shared_ptr-0a-operator_assign-09c]
= xref:bsl.adoc[bsl]::xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr]::operator&equals;
:relfileprefix: ../../
:mrdocs:

Assign from a compatible `shared&lowbar;ptr` `rhs`&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;sharedptr&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class COMPATIBLE&lowbar;TYPE&gt;
xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr]&
operator&equals;(xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr&lt;COMPATIBLE&lowbar;TYPE&gt;]&& rhs) noexcept
requires is&lowbar;convertible&lt;COMPATIBLE&lowbar;TYPE &ast;, ELEMENT&lowbar;TYPE &ast;&gt;&colon;&colon;value;
----

== Description

Make this shared pointer refer to and manage the same modifiable object as the specified `rhs` shared pointer to the (template parameter) type `COMPATIBLE&lowbar;TYPE`, using the same deleter as `rhs` and referring to `(ELEMENT&lowbar;TYPE &ast;)rhs&period;get()`, and return a reference to this modifiable shared pointer&period; If this shared pointer is already managing a (possibly shared) object, then release the shared reference to that object, and destroy it using its associated deleter if this shared pointer held the last shared reference to that object&period; Reset `rhs` to an empty state, not pointing to any object, unless `&ast;this` is the same object as `rhs`&period; This function does not exist unless a pointer to (template parameter) `COMPATIBLE&lowbar;TYPE` is convertible to a pointer to the (template parameter) `ELEMENT&lowbar;TYPE` of this `shared&lowbar;ptr`&period; Note that if `rhs` is empty, then this shared pointer will also be empty after the assignment&period;

== Return Value

reference providing modifiable access to this shared pointer

== Parameters

[cols="1,4"]
|===
| Name| Description
| *rhs*
| right&hyphen;hand side operand
|===


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