Created on 2021-05-04.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to N4885.
Modify [util.smartptr.shared.const] as indicated:
template<class Y, class D> shared_ptr(unique_ptr<Y, D>&& r);-28- Constraints: Y* is compatible with T* and unique_ptr<Y, D>::pointer is convertible to element_type*.
-29- Effects: If r.get() == nullptr, equivalent to shared_ptr(). Otherwise, if D is not a reference type, equivalent to shared_ptr(r.release(), std::move(r.get_deleter())). Otherwise, equivalent to shared_ptr(r.release(), ref(r.get_deleter())). If an exception is thrown, the constructor has no effect.
[ 2021-06-07 Approved at June 2021 virtual plenary. Status changed: Voting → WP. ]
[ 2021-05-17; Reflector poll ]
Set status to Tentatively Ready after eight votes in favour during reflector poll.
The construction of a shared_ptr from a suitable unique_ptr rvalue r (which was last modified by LWG 2415, but not in ways relevant to this issue) calls for shared_ptr(r.release(), r.get_deleter()) in the case where the deleter is not a reference.
This specification requires the deleter to be copyable, which seems like an unnecessary restriction. Note that the constructor unique_ptr(unique_ptr&& u) only requires u's deleter to be Cpp17MoveConstructible. By analogy, the constructor shared_ptr(unique_ptr<Y, D>&&) should also require D to be only move-, not copy-constructible.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2021-06-07 16:58:04 | admin | set | messages: + msg11911 |
2021-06-07 16:58:04 | admin | set | status: voting -> wp |
2021-05-26 21:11:22 | admin | set | status: ready -> voting |
2021-05-17 12:23:56 | admin | set | messages: + msg11807 |
2021-05-17 12:23:56 | admin | set | status: new -> ready |
2021-05-08 12:18:11 | admin | set | messages: + msg11791 |
2021-05-04 00:00:00 | admin | create |