Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(732)

Side by Side Diff: base/memory/scoped_vector.h

Issue 2047633002: Revert of Remove base/move.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/files/file.h ('k') | base/move.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 BASE_MEMORY_SCOPED_VECTOR_H_ 5 #ifndef BASE_MEMORY_SCOPED_VECTOR_H_
6 #define BASE_MEMORY_SCOPED_VECTOR_H_ 6 #define BASE_MEMORY_SCOPED_VECTOR_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/move.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 16
17 // ScopedVector wraps a vector deleting the elements from its 17 // ScopedVector wraps a vector deleting the elements from its
18 // destructor. 18 // destructor.
19 // 19 //
20 // TODO(http://crbug.com/554289): DEPRECATED: Use std::vector instead (now that 20 // TODO(http://crbug.com/554289): DEPRECATED: Use std::vector instead (now that
21 // we have support for moveable types inside containers). 21 // we have support for moveable types inside containers).
22 template <class T> 22 template <class T>
23 class ScopedVector { 23 class ScopedVector {
24 MOVE_ONLY_TYPE_FOR_CPP_03(ScopedVector)
25
24 public: 26 public:
25 typedef typename std::vector<T*>::allocator_type allocator_type; 27 typedef typename std::vector<T*>::allocator_type allocator_type;
26 typedef typename std::vector<T*>::size_type size_type; 28 typedef typename std::vector<T*>::size_type size_type;
27 typedef typename std::vector<T*>::difference_type difference_type; 29 typedef typename std::vector<T*>::difference_type difference_type;
28 typedef typename std::vector<T*>::pointer pointer; 30 typedef typename std::vector<T*>::pointer pointer;
29 typedef typename std::vector<T*>::const_pointer const_pointer; 31 typedef typename std::vector<T*>::const_pointer const_pointer;
30 typedef typename std::vector<T*>::reference reference; 32 typedef typename std::vector<T*>::reference reference;
31 typedef typename std::vector<T*>::const_reference const_reference; 33 typedef typename std::vector<T*>::const_reference const_reference;
32 typedef typename std::vector<T*>::value_type value_type; 34 typedef typename std::vector<T*>::value_type value_type;
33 typedef typename std::vector<T*>::iterator iterator; 35 typedef typename std::vector<T*>::iterator iterator;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return v_.erase(position); 135 return v_.erase(position);
134 } 136 }
135 137
136 // Like |erase()|, but doesn't delete the elements in [first, last). 138 // Like |erase()|, but doesn't delete the elements in [first, last).
137 iterator weak_erase(iterator first, iterator last) { 139 iterator weak_erase(iterator first, iterator last) {
138 return v_.erase(first, last); 140 return v_.erase(first, last);
139 } 141 }
140 142
141 private: 143 private:
142 std::vector<T*> v_; 144 std::vector<T*> v_;
143
144 DISALLOW_COPY_AND_ASSIGN(ScopedVector);
145 }; 145 };
146 146
147 #endif // BASE_MEMORY_SCOPED_VECTOR_H_ 147 #endif // BASE_MEMORY_SCOPED_VECTOR_H_
OLDNEW
« no previous file with comments | « base/files/file.h ('k') | base/move.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698