Allow 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
Review URL: http://codereview.chromium.org/8968032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117317 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 1b9718f6af29c36e7734e5cf6f828f968e7bd365
2 files changed