| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_COMMON_SCOPED_VECTOR_H__ | 5 #ifndef BASE_SCOPED_VECTOR_H_ |
| 6 #define CHROME_BROWSER_COMMON_SCOPED_VECTOR_H__ | 6 #define BASE_SCOPED_VECTOR_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "chrome/common/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| 11 | 11 |
| 12 // ScopedVector wraps a vector deleting the elements from its | 12 // ScopedVector wraps a vector deleting the elements from its |
| 13 // destructor. | 13 // destructor. |
| 14 template <class T> | 14 template <class T> |
| 15 class ScopedVector { | 15 class ScopedVector { |
| 16 public: | 16 public: |
| 17 typedef typename std::vector<T*>::iterator iterator; | 17 typedef typename std::vector<T*>::iterator iterator; |
| 18 typedef typename std::vector<T*>::const_iterator const_iterator; | 18 typedef typename std::vector<T*>::const_iterator const_iterator; |
| 19 | 19 |
| 20 ScopedVector() {} | 20 ScopedVector() {} |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 void release(std::vector<T*>* out) { out->swap(v); v.clear(); } | 41 void release(std::vector<T*>* out) { out->swap(v); v.clear(); } |
| 42 | 42 |
| 43 void reset() { STLDeleteElements(&v); } | 43 void reset() { STLDeleteElements(&v); } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 std::vector<T*> v; | 46 std::vector<T*> v; |
| 47 | 47 |
| 48 DISALLOW_EVIL_CONSTRUCTORS(ScopedVector); | 48 DISALLOW_EVIL_CONSTRUCTORS(ScopedVector); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 #endif // CHROME_BROWSER_COMMON_SCOPED_VECTOR_H__ | 51 #endif // BASE_SCOPED_VECTOR_H_ |
| OLD | NEW |