DescriptionAllow construction and assignment of one scoped_ptr from another if the types are convertible.
This allows for depth subtyping during a move operation on a scoped_ptr. With the additional constructor and operator=, we maintain move semantics but allow a scoped_ptr<A> to be constructed from a scoped_ptr<B> if B can be converted to A.
=DEFICIENCY=
This conversion sequence will _not_ implicitly work when calling an API. Specifically, if you have
void Func(scoped_ptr<Parent> p);
scoped_ptr<Child> c;
Func(c.Pass()); // COMPILE ERROR
This is a limitation of C++03 move emulation. The workaround is Func(scoped_ptr<Parent>(c.Pass());
BUG=109026
TEST=new unittests
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=117317
Patch Set 1 #Patch Set 2 : style fixes. #Patch Set 3 : rebased #Patch Set 4 : fix copyright #Messages
Total messages: 5 (0 generated)
|