Created on 2016-11-09.00:00:00 last changed 90 months ago
Proposed resolution:
Modify the synopsis in [unique.ptr.single] as follows:
[…] constexpr unique_ptr(nullptr_t) noexcept;: unique_ptr() { }[…]
Modify [unique.ptr.single.ctor] as follows:
constexpr unique_ptr() noexcept; constexpr unique_ptr(nullptr_t) noexcept;-1- Requires: D shall satisfy the requirements of DefaultConstructible (Table 22), and that construction shall not throw an exception.
-2- Effects: Constructs a unique_ptr object that owns nothing, value-initializing the stored pointer and the stored deleter. -3- Postconditions: get() == nullptr. get_deleter() returns a reference to the stored deleter. -4- Remarks:If this constructor is instantiated with a pointer type or reference type for the template argument D, the program is ill-formed.If is_pointer_v<deleter_type> is true or is_default_constructible_v<deleter_type> is false, this constructor shall not participate in overload resolution.explicit unique_ptr(pointer p) noexcept;[…]
-8- Remarks:
If this constructor is instantiated with a pointer type or reference type for the template argument D, the program is ill-formed.If is_pointer_v<deleter_type> is true or is_default_constructible_v<deleter_type> is false, this constructor shall not participate in overload resolution.
Modify the synopsis in [unique.ptr.runtime] as follows:
[…] constexpr unique_ptr(nullptr_t) noexcept;: unique_ptr() { }[…]
Modify [unique.ptr.runtime.ctor] as follows:
template <class U> explicit unique_ptr(U p) noexcept;This constructor behaves the same as the constructor that takes a pointer parameter in the primary template except that the following constraints are added for it to participate in overload resolution
U is the same type as pointer, or
pointer is the same type as element_type*, U is a pointer type V*, and V(*)[] is convertible to element_type(*)[].
template <class U> unique_ptr(U p, see below d) noexcept; template <class U> unique_ptr(U p, see below d) noexcept;1 These constructors behave the same as the constructors that take a pointer parameter in the primary template except that they shall not participate in overload resolution unless either
[ Kona 2017-03-02 ]
Accepted as Immediate to resolve NB comment.
[ 2017-03-02, Kona, STL comments and tweaks the wording ]
LWG discussed this issue, and we liked it, but we wanted to tweak the PR. I ran this past Ville (who drafted the PR with Howard), and he was in favor of tweaking this.
[ 2016-12-24: Howard and Ville provided wording. ]
[ Issues Telecon 16-Dec-2016 ]
Priority 2; Howard and Ville to provide wording.
Addresses US 122
unique_ptr should not satisfy is_constructible_v<unique_ptr<T, D>> unless D is DefaultConstructible and not a pointer type. This is important for interactions with pair, tuple, and variant constructors that rely on the is_default_constructible trait.Suggested resolution:
Add a Remarks: clause to constrain the default constructor to not exist unless the Requires clause is satisfied.History | |||
---|---|---|---|
Date | User | Action | Args |
2017-07-30 20:15:43 | admin | set | status: wp -> c++17 |
2017-03-05 23:46:08 | admin | set | status: immediate -> wp |
2017-03-03 22:19:58 | admin | set | messages: + msg9071 |
2017-03-03 22:19:58 | admin | set | status: new -> immediate |
2017-03-02 17:33:29 | admin | set | messages: + msg9037 |
2016-12-25 22:40:06 | admin | set | messages: + msg8771 |
2016-12-25 22:40:06 | admin | set | messages: + msg8770 |
2016-12-16 20:56:38 | admin | set | messages: + msg8731 |
2016-11-09 00:00:00 | admin | create |