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

Assignment operators

== Synopses

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

Copy&hyphen;assign from a compatible `shared&lowbar;ptr` `rhs`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr]&
xref:bsl/shared_ptr-0a/operator_assign-0f.adoc[operator&equals;](xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr] const& rhs) noexcept;
----

[.small]#xref:bsl/shared_ptr-0a/operator_assign-0f.adoc[_» more&period;&period;&period;_]#

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


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

[.small]#xref:bsl/shared_ptr-0a/operator_assign-097.adoc[_» more&period;&period;&period;_]#

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


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class COMPATIBLE&lowbar;TYPE&gt;
xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr]&
xref:bsl/shared_ptr-0a/operator_assign-09c.adoc[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;
----

[.small]#xref:bsl/shared_ptr-0a/operator_assign-09c.adoc[_» more&period;&period;&period;_]#

Move&hyphen;assign from a compatible `shared&lowbar;ptr` `rhs`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr]&
xref:bsl/shared_ptr-0a/operator_assign-0e.adoc[operator&equals;](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;shared&lowbar;ptr&gt;] rhs) noexcept;
----

[.small]#xref:bsl/shared_ptr-0a/operator_assign-0e.adoc[_» more&period;&period;&period;_]#

Assign from a managed pointer, taking ownership of `rhs`&period;


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

[.small]#xref:bsl/shared_ptr-0a/operator_assign-0a.adoc[_» more&period;&period;&period;_]#

Assign from an auto pointer, taking ownership of `rhs`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class COMPATIBLE&lowbar;TYPE&gt;
xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr]&
xref:bsl/shared_ptr-0a/operator_assign-02.adoc[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]#xref:bsl/shared_ptr-0a/operator_assign-02.adoc[_» more&period;&period;&period;_]#

Assign from a unique pointer, taking ownership of `rhs`&period;


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

[.small]#xref:bsl/shared_ptr-0a/operator_assign-090.adoc[_» more&period;&period;&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]#
