This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

1021. Allow nullptr_t assignments to unique_ptr

Section: [unique.ptr.single.asgn] Status: C++11 Submitter: Alisdair Meredith Opened: 2009-03-11 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [unique.ptr.single.asgn].

View all issues with C++11 status.


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 [unique.ptr.single]:

unique_ptr& operator=(unspecified-pointer-type nullptr_t);

Change [unique.ptr.single.asgn]:

unique_ptr& operator=(unspecified-pointer-type nullptr_t);

Assigns from the literal 0 or NULL. [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]