Title
Minor cleanup : unique_ptr
Status
c++11
Section
[unique.ptr.runtime.modifiers]
Submitter
Alisdair Meredith

Created on 2008-03-30.00:00:00 last changed 162 months ago

Messages

Date: 2010-10-21.18:28:33

[ Note this wording incorporates resolutions for 806 (New) and 673 (Ready). ]

Date: 2010-10-21.18:28:33

Proposed resolution:

Add to class template definition in [unique.ptr.runtime]

// modifiers 
pointer release(); 
void reset(pointer p = pointer()); 
void reset( nullptr_t );
template< typename U > void reset( U ) = delete;
void swap(unique_ptr&& u);

Update [unique.ptr.runtime.modifiers]

void reset(pointer p = pointer());
void reset(nullptr_t);

-1- Requires: Does not accept pointer types which are convertible to pointer (diagnostic required). [Note: One implementation technique is to create a private templated overload. -- end note]

Effects: If get() == nullptr there are no effects. Otherwise get_deleter()(get()).

...

Date: 2008-03-30.00:00:00

Reading resolution of LWG issue 673 I noticed the following:

void reset(T* pointer p = 0 pointer());

-1- Requires: Does not accept pointer types which are convertible to T* pointer (diagnostic required). [Note: One implementation technique is to create a private templated overload. -- end note]

This could be cleaned up by mandating the overload as a public deleted function. In addition, we should probably overload reset on nullptr_t to be a stronger match than the deleted overload. Words...

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg3919
2010-10-21 18:28:33adminsetmessages: + msg3918
2008-03-30 00:00:00admincreate