Index: base/scoped_generic.h |
diff --git a/base/scoped_generic.h b/base/scoped_generic.h |
index da42609e5c484cefc5024f9968f836ea0292eecc..f6807e2b58f2fa3fe425b5e9b0e51a4725b5d963 100644 |
--- a/base/scoped_generic.h |
+++ b/base/scoped_generic.h |
@@ -53,7 +53,7 @@ namespace base { |
// typedef ScopedGeneric<int, FooScopedTraits> ScopedFoo; |
template<typename T, typename Traits> |
class ScopedGeneric { |
- MOVE_ONLY_TYPE_FOR_CPP_03(ScopedGeneric, RValue) |
+ MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(ScopedGeneric) |
private: |
// This must be first since it's used inline below. |
@@ -83,15 +83,21 @@ class ScopedGeneric { |
: data_(value, traits) { |
} |
- // Move constructor for C++03 move emulation. |
- ScopedGeneric(RValue rvalue) |
- : data_(rvalue.object->release(), rvalue.object->get_traits()) { |
+ // Move constructor. Allows initialization from a ScopedGeneric rvalue. |
+ ScopedGeneric(ScopedGeneric<T, Traits>&& rvalue) |
+ : data_(rvalue.release(), rvalue.get_traits()) { |
} |
~ScopedGeneric() { |
FreeIfNecessary(); |
} |
+ // operator=. Allows assignment from a ScopedGeneric rvalue. |
+ ScopedGeneric& operator=(ScopedGeneric<T, Traits>&& rvalue) { |
+ reset(rvalue.release()); |
+ return *this; |
+ } |
+ |
// Frees the currently owned object, if any. Then takes ownership of a new |
// object, if given. Self-resets are not allowd as on scoped_ptr. See |
// http://crbug.com/162971 |