Title
rvalue swap for shared_ptr
Status
cd1
Section
[util.smartptr.shared.spec]
Submitter
Howard Hinnant

Created on 2007-10-10.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change the synopsis in [util.smartptr.shared]:

void swap(shared_ptr&& r);
...
template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b);
template<class T> void swap(shared_ptr<T>&& a, shared_ptr<T>& b);
template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>&& b);

Change [util.smartptr.shared.mod]:

void swap(shared_ptr&& r);

Change [util.smartptr.shared.spec]:

template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b);
template<class T> void swap(shared_ptr<T>&& a, shared_ptr<T>& b);
template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>&& b);
Date: 2010-10-21.18:28:33

[ Bellevue: ]

Concern that the three signatures for swap is needlessly complicated, but this issue merely brings shared_ptr into equal complexity with the rest of the library. Will open a new issue for concern about triplicate signatures.

Adopt issue as written.

Date: 2007-10-10.00:00:00

When the LWG looked at 674 in Kona the following note was made:

We may need to open an issue to deal with the question of whether shared_ptr needs an rvalue swap.

This issue was opened in response to that note.

I believe allowing rvalue shared_ptrs to swap is both appropriate, and consistent with how other library components are currently specified.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3632
2010-10-21 18:28:33adminsetmessages: + msg3631
2007-10-10 00:00:00admincreate