[#bsl-shared_ptr-0a-operator_assign-0a] = xref:bsl.adoc[bsl]::xref:bsl/shared_ptr-0a.adoc[shared_ptr]::operator= :relfileprefix: ../../ :mrdocs: Transfer, to this shared pointer, ownership of the modifiable object managed by the specified `rhs` managed pointer to the (template parameter) type `COMPATIBLE_TYPE`, and make this shared pointer refer to `(ELEMENT_TYPE *)rhs.ptr()`. The deleter used in the `rhs` will be used to destroy the shared object when all references have been released. The _default_ _allocator_ is used to allocate a `SharedPtrRep`, if needed (users must use the copy‐constructor and swap instead of using this operator to supply an alternative allocator). 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. Note that if `rhs` is empty, then this shared pointer will be empty after the assignment. Also note that if `rhs` owns a reference to another shared object (due to a previous call to `shared_ptr<T>::managedPtr`) then this `shared_ptr` will adopt the `ManagedPtr`s ownership of that shared object. == Synopsis Declared in `<bslstl_sharedptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class COMPATIBLE_TYPE> xref:bsl/shared_ptr-0a.adoc[shared_ptr]& operator=(xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[BloombergLP::bslma::ManagedPtr<COMPATIBLE_TYPE>] rhs) requires is_convertible<COMPATIBLE_TYPE *, ELEMENT_TYPE *>::value; ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#