std::weak_ptr::operator=

From cppreference.com
 
 
 
 
 
weak_ptr& operator=( const weak_ptr& r );
(1) (since C++11)
template< class Y >
weak_ptr& operator=( const weak_ptr<Y>& r );
(2) (since C++11)
template< class Y >
weak_ptr& operator=( const shared_ptr<Y>& r );
(3) (since C++11)

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. Equivalent to weak_ptr<T>(r).swap(*this).

Contents

[edit] Parameters

r - smart pointer to share an object with

[edit] Return value

*this

[edit] Exceptions

noexcept specification:  
noexcept
  (since C++11)

[edit] Notes

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