nullptr_t
assignments to unique_ptr
Section: 20.3.1.3.4 [unique.ptr.single.asgn] Status: C++11 Submitter: Alisdair Meredith Opened: 2009-03-11 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [unique.ptr.single.asgn].
View all issues with C++11 status.
Discussion:
Addresses UK 211 [CD1]
The nullptr_t
type was introduced to resolve the null pointer literal
problem. It should be used for the assignment operator, as with the
constructor and elsewhere through the library.
[ Batavia (2009-05): ]
We agree with the proposed resolution. Move to Tentatively Ready.
Proposed resolution:
Change the synopsis in 20.3.1.3 [unique.ptr.single]:
unique_ptr& operator=(unspecified-pointer-typenullptr_t);
Change 20.3.1.3.4 [unique.ptr.single.asgn]:
unique_ptr& operator=(unspecified-pointer-typenullptr_t);
Assigns from the literal 0 orNULL
. [Note: The unspecified-pointer-type is often implemented as a pointer to a private data member, avoiding many of the implicit conversion pitfalls. — end note]