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

Transfer, to this shared pointer, ownership of the modifiable object managed by the specified `rhs` auto pointer to the (template parameter) type `COMPATIBLE&lowbar;TYPE`, and make this shared pointer refer to `(ELEMENT&lowbar;TYPE &ast;)rhs&period;get()`&period; `delete(autoPtr&period;release())` will be called to destroy the shared object when all references have been released&period; If this shared pointer is already managing a (possibly shared) object, then release the reference to that shared object, and destroy it using its associated deleter if this shared pointer held the last shared reference to that object&period; Note that if `rhs` is empty, then this shared pointer will be empty after the assignment&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;(std::auto&lowbar;ptr&lt;COMPATIBLE&lowbar;TYPE&gt; rhs)
requires is&lowbar;convertible&lt;COMPATIBLE&lowbar;TYPE &ast;, ELEMENT&lowbar;TYPE &ast;&gt;&colon;&colon;value;
----


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