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

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

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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/memory/ref_counted_delete_on_message_loop.h ('k') | base/memory/shared_memory.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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 void clear() { STLDeleteElements(&v_); } 99 void clear() { STLDeleteElements(&v_); }
100 100
101 // Like |clear()|, but doesn't delete any elements. 101 // Like |clear()|, but doesn't delete any elements.
102 void weak_clear() { v_.clear(); } 102 void weak_clear() { v_.clear(); }
103 103
104 // Lets the ScopedVector take ownership of |x|. 104 // Lets the ScopedVector take ownership of |x|.
105 iterator insert(iterator position, T* x) { 105 iterator insert(iterator position, T* x) {
106 return v_.insert(position, x); 106 return v_.insert(position, x);
107 } 107 }
108 108
109 iterator insert(iterator position, scoped_ptr<T> x) {
110 return v_.insert(position, x.release());
111 }
112
109 // Lets the ScopedVector take ownership of elements in [first,last). 113 // Lets the ScopedVector take ownership of elements in [first,last).
110 template<typename InputIterator> 114 template<typename InputIterator>
111 void insert(iterator position, InputIterator first, InputIterator last) { 115 void insert(iterator position, InputIterator first, InputIterator last) {
112 v_.insert(position, first, last); 116 v_.insert(position, first, last);
113 } 117 }
114 118
115 iterator erase(iterator position) { 119 iterator erase(iterator position) {
116 delete *position; 120 delete *position;
117 return v_.erase(position); 121 return v_.erase(position);
118 } 122 }
(...skipping 11 matching lines...) Expand all
130 // Like |erase()|, but doesn't delete the elements in [first, last). 134 // Like |erase()|, but doesn't delete the elements in [first, last).
131 iterator weak_erase(iterator first, iterator last) { 135 iterator weak_erase(iterator first, iterator last) {
132 return v_.erase(first, last); 136 return v_.erase(first, last);
133 } 137 }
134 138
135 private: 139 private:
136 std::vector<T*> v_; 140 std::vector<T*> v_;
137 }; 141 };
138 142
139 #endif // BASE_MEMORY_SCOPED_VECTOR_H_ 143 #endif // BASE_MEMORY_SCOPED_VECTOR_H_
OLDNEW
« no previous file with comments | « base/memory/ref_counted_delete_on_message_loop.h ('k') | base/memory/shared_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698