Title
shared_ptr, unique_ptr, and rvalue references v2
Status
c++11
Section
[unique.ptr.single][util.smartptr.shared]
Submitter
Stephan T. Lavavej

Created on 2010-01-23.00:00:00 last changed 162 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Strike from [unique.ptr.single]:

template <class T, class D = default_delete<T>> class unique_ptr {
  ...
  unique_ptr(const unique_ptr&) = delete;
  template <class U, class E> unique_ptr(const unique_ptr<U, E>&) = delete;
  unique_ptr& operator=(const unique_ptr&) = delete;
  template <class U, class E> unique_ptr& operator=(const unique_ptr<U, E>&) = delete;
};

Strike from [util.smartptr.shared]:

template<class T> class shared_ptr {
  ...
  template <class Y, class D> explicit shared_ptr(const unique_ptr<Y, D>& r) = delete;
  ...
  template <class Y, class D> shared_ptr& operator=(const unique_ptr<Y, D>& r) = delete;
  ...
};
Date: 2010-02-12.00:00:00

[ 2010-02-12 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

Date: 2010-01-23.00:00:00

N3000 [util.smartptr.shared]/1 still says:

template <class Y, class D> explicit shared_ptr(const unique_ptr<Y, D>& r) = delete;
template <class Y, class D> shared_ptr& operator=(const unique_ptr<Y, D>& r) = delete;

I believe that this is unnecessary now that "rvalue references v2" prevents rvalue references from binding to lvalues, and I didn't see a Library Issue tracking this.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg1522
2010-10-21 18:28:33adminsetmessages: + msg1521
2010-01-23 00:00:00admincreate