Add a move constructor and move assignment operator to scoped_ptr.

Previously, scoped_ptr only had a conversion constructor with a
scoped_ptr<U, E> rvalue reference argument. Since this isn't an
actual move constructor, this prevented clang's pessimizing move
warning from trigger on code like this:
  scoped_ptr<int> F() { scoped_ptr<int> i; return std::move(i); }

In addition, the conversion constructor is now disabled if <U, E>
are not convertible to <T, D> respectively. This is important so:
  1. type_traits like std::is_convertible don't incorrectly treat
     scoped_ptr<Base> as convertible to scoped_ptr<Derived>.
  2. Code like this compiles:
     void F(scoped_ptr<int>);
     void F(scoped_ptr<Base>);

     F(scoped_ptr<Derived>());

For symmetry, scoped_ptr also has a move assignment operator now,
and the conversion assignment operator has been updated to match
the conditions when the conversion constructor is disabled via
SFINAE.

BUG=557438

Review URL: https://codereview.chromium.org/1454993003

Cr-Commit-Position: refs/heads/master@{#360737}


CrOS-Libchrome-Original-Commit: ecdd662b725c21d5536defc8d6be81ed781caa07
1 file changed
tree: 45a5ff7f6fe4819628a7ee41751b216a00ab430b
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/