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.
shared_ptr
conversion issueSection: 20.3.2.2.2 [util.smartptr.shared.const] Status: C++11 Submitter: Peter Dimov Opened: 2008-08-30 Last modified: 2016-01-28
Priority: Not Prioritized
View other active issues in [util.smartptr.shared.const].
View all other issues in [util.smartptr.shared.const].
View all issues with C++11 status.
Discussion:
We've changed shared_ptr<Y>
to not convert to shared_ptr<T>
when Y*
doesn't convert to T*
by resolving issue 687(i). This only fixed the
converting copy constructor though.
N2351
later added move support, and
the converting move constructor is not constrained.
[ San Francisco: ]
We might be able to move this to NAD, Editorial once shared_ptr is conceptualized, but we want to revisit this issue to make sure.
[ 2009-07 Frankfurt ]
Moved to Ready.
This issue now represents the favored format for specifying constrained templates.
Proposed resolution:
We need to change the Requires clause of the move constructor:
shared_ptr(shared_ptr&& r); template<class Y> shared_ptr(shared_ptr<Y>&& r);
RequiresRemarks:For the second constructorThe second constructor shall not participate in overload resolution unlessY*
shall be convertible toT*
.Y*
is convertible toT*
.
in order to actually make the example in 687(i) compile (it now resolves to the move constructor).