std::weak_ptr<T>::operator=

Replaces the managed object with the one managed by r. The object is shared with r. If r manages no object, *this manages no object too.

# Declarations

weak_ptr& operator=( const weak_ptr& r ) noexcept;

(since C++11)

template< class Y >
weak_ptr& operator=( const weak_ptr<Y>& r ) noexcept;

(since C++11)

template< class Y >
weak_ptr& operator=( const shared_ptr<Y>& r ) noexcept;

(since C++11)

weak_ptr& operator=( weak_ptr&& r ) noexcept;

(since C++11)

template< class Y >
weak_ptr& operator=( weak_ptr<Y>&& r ) noexcept;

(since C++11)

# Parameters

# Return value

*this

# Notes

The implementation may meet the requirements without creating a temporary weak_ptr object.

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 2315C++11move semantic was not enabled for weak_ptrenabled

# See also