std::weak_ptr<T>::operator=
Min standard notice:
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
r: smart pointer to share an object with
# Return value
*this
# Notes
The implementation may meet the requirements without creating a temporary weak_ptr object.
# Defect reports
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2315 | C++11 | move semantic was not enabled for weak_ptr | enabled |