[#bsl-weak_ptr-0d-operator_assign-09] = xref:bsl.adoc[bsl]::xref:bsl/weak_ptr-0d.adoc[weak_ptr]::operator= :relfileprefix: ../../ :mrdocs: Assignment operators == Synopses Declared in `<bslstl_sharedptr.h>` Make this weak pointer refer to the same object (if any) as the specified `rhs` weak pointer. 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). Return a reference providing modifiable access to this weak pointer. Note that if `rhs` is in an empty state, this weak pointer will be set to an empty state. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/weak_ptr-0d.adoc[weak_ptr]& xref:bsl/weak_ptr-0d/operator_assign-0d03.adoc[operator=](xref:bsl/weak_ptr-0d.adoc[weak_ptr] const& rhs) noexcept; ---- [.small]#xref:bsl/weak_ptr-0d/operator_assign-0d03.adoc[_» more..._]# Make this weak pointer refer to the same object (if any) as the specified `rhs` (shared or weak) pointer to the (template parameter) `COMPATIBLE_TYPE`. 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). Return a reference providing modifiable access to this weak pointer. If `COMPATIBLE_TYPE *` is not implicitly convertible to `TYPE *`, then a compiler diagnostic will be emitted. Note that if `rhs` is in the empty state, this weak pointer will be set to the empty state. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class COMPATIBLE_TYPE> xref:bsl/weak_ptr-0d.adoc[weak_ptr]& xref:bsl/weak_ptr-0d/operator_assign-03.adoc[operator=](xref:bsl/weak_ptr-0d.adoc[weak_ptr<COMPATIBLE_TYPE>] const& rhs) noexcept requires is_convertible<COMPATIBLE_TYPE *, ELEMENT_TYPE *>::value; ---- [.small]#xref:bsl/weak_ptr-0d/operator_assign-03.adoc[_» more..._]# Make this weak pointer refer to the same object (if any) as the specified `rhs` weak pointer of compatible type. Decrement the number of weak references to the object this weak pointer managed (if any), and reset `rhs` to an empty state. Return a reference providing modifiable access to this weak pointer. This function does not exist unless a pointer to (the template parameter) `COMPATIBLE_TYPE` is convertible to a pointer to (the template parameter) `ELEMENT_TYPE`. Note that if `rhs` is in an empty state, this weak pointer will be set to an empty state. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class COMPATIBLE_TYPE> xref:bsl/weak_ptr-0d.adoc[weak_ptr]& xref:bsl/weak_ptr-0d/operator_assign-08.adoc[operator=](xref:bsl/weak_ptr-0d.adoc[weak_ptr<COMPATIBLE_TYPE>]&& rhs) noexcept requires is_convertible<COMPATIBLE_TYPE *, ELEMENT_TYPE *>::value; ---- [.small]#xref:bsl/weak_ptr-0d/operator_assign-08.adoc[_» more..._]# Make this weak pointer refer to the same object (if any) as the specified `rhs` weak pointer. 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. Return a reference providing modifiable access to this weak pointer. Note that if `rhs` is in an empty state, this weak pointer will be set to an empty state. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/weak_ptr-0d.adoc[weak_ptr]& xref:bsl/weak_ptr-0d/operator_assign-0d07.adoc[operator=](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<weak_ptr>] rhs) noexcept; ---- [.small]#xref:bsl/weak_ptr-0d/operator_assign-0d07.adoc[_» more..._]# Assign from the specified compatible `shared_ptr` `rhs`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class COMPATIBLE_TYPE> xref:bsl/weak_ptr-0d.adoc[weak_ptr]& xref:bsl/weak_ptr-0d/operator_assign-02.adoc[operator=](xref:bsl/shared_ptr-0a.adoc[shared_ptr<COMPATIBLE_TYPE>] const& rhs) noexcept requires is_convertible<COMPATIBLE_TYPE *, ELEMENT_TYPE *>::value; ---- [.small]#xref:bsl/weak_ptr-0d/operator_assign-02.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#