unique_ptr
Section: 20.3.1.4.5 [unique.ptr.runtime.modifiers] Status: C++11 Submitter: Alisdair Meredith Opened: 2008-03-30 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [unique.ptr.runtime.modifiers].
View all issues with C++11 status.
Discussion:
Reading resolution of LWG issue 673 I noticed the following:
void reset(T*pointer p =0pointer());-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...
Proposed resolution:
Add to class template definition in 20.3.1.4 [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 20.3.1.4.5 [unique.ptr.runtime.modifiers]
void reset(pointer p = pointer()); void reset(nullptr_t);
-1- Requires: Does not accept pointer types which are convertible topointer
(diagnostic required). [Note: One implementation technique is to create a private templated overload. -- end note]Effects: If
get() == nullptr
there are no effects. Otherwiseget_deleter()(get())
....
[ Note this wording incorporates resolutions for 806 (New) and 673 (Ready). ]