Created on 2007-05-10.00:00:00 last changed 172 months ago
Proposed resolution:
In [util.smartptr.shared.const], change:
-14- Requires:
For the second constructorThe second constructor shall not participate in the overload resolution unless Y*shall beis implicitly convertible to T*.
In [util.smartptr.weak.const], change:
template<class Y> weak_ptr(shared_ptr<Y> const& r);weak_ptr(weak_ptr const& r);template<class Y> weak_ptr(weak_ptr<Y> const& r);weak_ptr(weak_ptr const& r); template<class Y> weak_ptr(weak_ptr<Y> const& r); template<class Y> weak_ptr(shared_ptr<Y> const& r);-4- Requires:
FortThe second and third constructors,shall not participate in the overload resolution unless Y*shall beis implicitly convertible to T*.
Since all conversions from shared_ptr<T> to shared_ptr<U> have the same rank regardless of the relationship between T and U, reasonable user code that works with raw pointers fails with shared_ptr:
void f( shared_ptr<void> ); void f( shared_ptr<int> ); int main() { f( shared_ptr<double>() ); // ambiguous }
Now that we officially have enable_if, we can constrain the constructor and the corresponding assignment operator to only participate in the overload resolution when the pointer types are compatible.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg3442 |
2007-05-10 00:00:00 | admin | create |