weak_ptr& operator=( const weak_ptr& r ) noexcept; | (1) | (since C++11) |
template< class Y > weak_ptr& operator=( const weak_ptr<Y>& r ) noexcept; | (2) | (since C++11) |
template< class Y > weak_ptr& operator=( const shared_ptr<Y>& r ) noexcept; | (3) | (since C++11) |
weak_ptr& operator=( weak_ptr&& r ) noexcept; | (4) | (since C++14) |
template< class Y > weak_ptr& operator=( weak_ptr<Y>&& r ) noexcept; | (5) | (since C++14) |
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.
std::weak_ptr<T>(r).swap(*this)
.std::weak_ptr<T>(std::move(r)).swap(*this)
.r | - | smart pointer to share an object with |
*this
.
The implementation may meet the requirements without creating a temporary weak_ptr
object.
creates a new weak_ptr (public member function) |
|
swaps the managed objects (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/memory/weak_ptr/operator=