BloombergLP::bslma::ManagedPtr::operator=

Assign ownership from compatible rhs to this managed pointer.

Synopsis

Declared in <bslma_managedptr.h>

template<class BDE_OTHER_TYPE>
ManagedPtr<TARGET_TYPE>&
operator=(ManagedPtr<BDE_OTHER_TYPE>&& rhs) noexcept
requires bsl::is_convertible<BDE_OTHER_TYPE *, TARGET_TYPE *>::value;

Description

If this object and the specified rhs manage the same object, return a reference to this managed pointer; otherwise, destroy the managed object owned by this managed pointer, transfer ownership of the managed object owned by rhs to this managed pointer, set this managed pointer to point to the target object referenced by rhs, reset rhs to empty, and return a reference to this managed pointer. TARGET_TYPE must be an accessible and unambiguous base of BDE_OTHER_TYPE.

Return Value

reference to this managed pointer

Parameters

NameDescription
rhscompatible managed pointer from which to take ownership