Chromium Code Reviews| Index: base/memory/scoped_vector.h |
| diff --git a/base/memory/scoped_vector.h b/base/memory/scoped_vector.h |
| index 832d9dd04661d3569dc7b4e93d5464cad754d0df..4c43802fa80d8ab6eb175514dc55a731914f3771 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); |
|
darin (slow to review)
2012/01/19 05:17:30
I think it might improve readability of the code t
|
| + |
| 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_ |