Created on 2013-09-21.00:00:00 last changed 130 months ago
Proposed resolution:
This wording is relative to N3691.
Edit [util.smartptr.weak]/1, class template weak_ptr synopsis, as indicated:
namespace std { template<class T> class weak_ptr { public: typedef T element_type; // 20.9.2.3.1, constructors constexpr weak_ptr() noexcept; template<class Y> weak_ptr(shared_ptr<Y> const& r) noexcept; weak_ptr(weak_ptr const& r) noexcept; template<class Y> weak_ptr(weak_ptr<Y> const& r) noexcept; weak_ptr(weak_ptr&& r) noexcept; template<class Y> weak_ptr(weak_ptr<Y>&& r) noexcept; […] // 20.9.2.3.3, assignment weak_ptr& operator=(weak_ptr const& r) noexcept; template<class Y> weak_ptr& operator=(weak_ptr<Y> const& r) noexcept; template<class Y> weak_ptr& operator=(shared_ptr<Y> const& r) noexcept; weak_ptr& operator=(weak_ptr&& r) noexcept; template<class Y> weak_ptr& operator=(weak_ptr<Y>&& r) noexcept; }; }
Add the following new paragraphs at the end of sub-clause [util.smartptr.weak.const]:
weak_ptr(weak_ptr&& r) noexcept; template<class Y> weak_ptr(weak_ptr<Y>&& r) noexcept;-?- Remark: The second constructor shall not participate in overload resolution unless Y* is implicitly convertible to T*.
-?- Effects: Move-constructs a weak_ptr instance from r. -?- Postconditions: *this shall contain the old value of r. r shall be empty. r.use_count() == 0.
Edit [util.smartptr.weak.assign] as indicated:
weak_ptr& operator=(const weak_ptr& r) noexcept; template<class Y> weak_ptr& operator=(const weak_ptr<Y>& r) noexcept; template<class Y> weak_ptr& operator=(const shared_ptr<Y>& r) noexcept;-1- Effects: […]
-2- Remarks: […] -?- Returns: *this.
weak_ptr& operator=(weak_ptr&& r) noexcept; template<class Y> weak_ptr& operator=(weak_ptr<Y>&& r) noexcept;-?- Effects: Equivalent to weak_ptr(std::move(r)).swap(*this).
-?- Returns: *this.
[ 2014-02-13 Issaquah: Move to Immediate ]
Like shared_ptr, weak_ptr should be movable to avoid unnecessary atomic increments/decrements of the weak refcount.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-02-27 17:03:20 | admin | set | status: wp -> c++14 |
2014-02-20 13:52:38 | admin | set | status: immediate -> wp |
2014-02-14 07:07:05 | admin | set | messages: + msg6854 |
2014-02-14 07:07:05 | admin | set | status: new -> immediate |
2013-10-11 17:45:06 | admin | set | messages: + msg6699 |
2013-09-21 00:00:00 | admin | create |