[#bsl-weak_ptr-0d-operator_assign-09]
= xref:bsl.adoc[bsl]::xref:bsl/weak_ptr-0d.adoc[weak&lowbar;ptr]::operator&equals;
:relfileprefix: ../../
:mrdocs:

Assignment operators

== Synopses

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

Make this weak pointer refer to the same object (if any) as the specified `rhs` weak pointer&period; Decrement the number of weak references to the object this weak pointer manages (if any), and increment the number of weak references to the object managed by `rhs` (if any)&period; Return a reference providing modifiable access to this weak pointer&period; Note that if `rhs` is in an empty state, this weak pointer will be set to an empty state&period;


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

[.small]#xref:bsl/weak_ptr-0d/operator_assign-0d03.adoc[_» more&period;&period;&period;_]#

Make this weak pointer refer to the same object (if any) as the specified `rhs` (shared or weak) pointer to the (template parameter) `COMPATIBLE&lowbar;TYPE`&period; Decrement the number of weak references to the object to which this weak pointer currently manages (if any), and increment the number of weak references to the object managed by `rhs` (if any)&period; Return a reference providing modifiable access to this weak pointer&period; If `COMPATIBLE&lowbar;TYPE &ast;` is not implicitly convertible to `TYPE &ast;`, then a compiler diagnostic will be emitted&period; Note that if `rhs` is in the empty state, this weak pointer will be set to the empty state&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class COMPATIBLE&lowbar;TYPE&gt;
xref:bsl/weak_ptr-0d.adoc[weak&lowbar;ptr]&
xref:bsl/weak_ptr-0d/operator_assign-03.adoc[operator&equals;](xref:bsl/weak_ptr-0d.adoc[weak&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/weak_ptr-0d/operator_assign-03.adoc[_» more&period;&period;&period;_]#

Make this weak pointer refer to the same object (if any) as the specified `rhs` weak pointer of compatible type&period; Decrement the number of weak references to the object this weak pointer managed (if any), and reset `rhs` to an empty state&period; Return a reference providing modifiable access to this weak pointer&period; This function does not exist unless a pointer to (the template parameter) `COMPATIBLE&lowbar;TYPE` is convertible to a pointer to (the template parameter) `ELEMENT&lowbar;TYPE`&period; Note that if `rhs` is in an empty state, this weak pointer will be set to an empty state&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class COMPATIBLE&lowbar;TYPE&gt;
xref:bsl/weak_ptr-0d.adoc[weak&lowbar;ptr]&
xref:bsl/weak_ptr-0d/operator_assign-08.adoc[operator&equals;](xref:bsl/weak_ptr-0d.adoc[weak&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/weak_ptr-0d/operator_assign-08.adoc[_» more&period;&period;&period;_]#

Make this weak pointer refer to the same object (if any) as the specified `rhs` weak pointer&period; If `rhs` is not a reference to this weak pointer, decrement the number of weak references to the object this weak pointer managed (if any), and reset `rhs` to an empty state&period; Return a reference providing modifiable access to this weak pointer&period; Note that if `rhs` is in an empty state, this weak pointer will be set to an empty state&period;


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

[.small]#xref:bsl/weak_ptr-0d/operator_assign-0d07.adoc[_» more&period;&period;&period;_]#

Assign from the specified compatible `shared&lowbar;ptr` `rhs`&period;


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


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