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.

### 1303. `shared_ptr`, `unique_ptr`, and rvalue references v2

Section: 20.11.1.3 [unique.ptr.single], 20.11.3 [util.smartptr.shared] Status: C++11 Submitter: Stephan T. Lavavej Opened: 2010-01-23 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [unique.ptr.single].

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

View all issues with C++11 status.

Discussion:

N3000 20.11.3 [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.

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

Proposed resolution:

Strike from 20.11.1.3 [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 20.11.3 [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;
>       ...
>     };