Index: base/memory/scoped_vector.h |
diff --git a/base/memory/scoped_vector.h b/base/memory/scoped_vector.h |
index 832d9dd04661d3569dc7b4e93d5464cad754d0df..ba2e1a0e1f1b2fd58844ffb7aba71b57ace961a2 100644 |
--- a/base/memory/scoped_vector.h |
+++ b/base/memory/scoped_vector.h |
@@ -9,12 +9,15 @@ |
#include <vector> |
#include "base/basictypes.h" |
+#include "base/move.h" |
#include "base/stl_util.h" |
// ScopedVector wraps a vector deleting the elements from its |
// destructor. |
template <class T> |
class ScopedVector { |
+ MOVE_ONLY_TYPE_FOR_CPP_03(ScopedVector, RValue); |
+ |
public: |
typedef typename std::vector<T*>::iterator iterator; |
typedef typename std::vector<T*>::const_iterator const_iterator; |
@@ -24,6 +27,12 @@ class ScopedVector { |
ScopedVector() {} |
~ScopedVector() { reset(); } |
+ ScopedVector(RValue& other) { swap(other); } |
+ |
+ ScopedVector& operator=(RValue& rhs) { |
+ swap(rhs); |
+ return *this; |
+ } |
std::vector<T*>* operator->() { return &v; } |
const std::vector<T*>* operator->() const { return &v; } |
@@ -89,8 +98,6 @@ class ScopedVector { |
} |
private: |
std::vector<T*> v; |
- |
- DISALLOW_COPY_AND_ASSIGN(ScopedVector); |
}; |
#endif // BASE_MEMORY_SCOPED_VECTOR_H_ |