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

Side by Side Diff: base/stl_util.h

Issue 2746053002: Fix Template Parameter List for Associative Containers in base::EraseIf (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | base/stl_util_unittest.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Derived from google3/util/gtl/stl_util.h 5 // Derived from google3/util/gtl/stl_util.h
6 6
7 #ifndef BASE_STL_UTIL_H_ 7 #ifndef BASE_STL_UTIL_H_
8 #define BASE_STL_UTIL_H_ 8 #define BASE_STL_UTIL_H_
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // types and does not force a conversion to the container's value type before 215 // types and does not force a conversion to the container's value type before
216 // invoking the == operator. 216 // invoking the == operator.
217 container.remove_if([&](const T& cur) { return cur == value; }); 217 container.remove_if([&](const T& cur) { return cur == value; });
218 } 218 }
219 219
220 template <class T, class Allocator, class Predicate> 220 template <class T, class Allocator, class Predicate>
221 void EraseIf(std::list<T, Allocator>& container, Predicate pred) { 221 void EraseIf(std::list<T, Allocator>& container, Predicate pred) {
222 container.remove_if(pred); 222 container.remove_if(pred);
223 } 223 }
224 224
225 template <class T, class Allocator, class Predicate> 225 template <class Key, class T, class Compare, class Allocator, class Predicate>
226 void EraseIf(std::map<T, Allocator>& container, Predicate pred) { 226 void EraseIf(std::map<Key, T, Compare, Allocator>& container, Predicate pred) {
227 internal::IterateAndEraseIf(container, pred); 227 internal::IterateAndEraseIf(container, pred);
228 } 228 }
229 229
230 template <class T, class Allocator, class Predicate> 230 template <class Key, class T, class Compare, class Allocator, class Predicate>
231 void EraseIf(std::multimap<T, Allocator>& container, Predicate pred) { 231 void EraseIf(std::multimap<Key, T, Compare, Allocator>& container,
232 Predicate pred) {
232 internal::IterateAndEraseIf(container, pred); 233 internal::IterateAndEraseIf(container, pred);
233 } 234 }
234 235
235 template <class T, class Allocator, class Predicate> 236 template <class Key, class Compare, class Allocator, class Predicate>
236 void EraseIf(std::set<T, Allocator>& container, Predicate pred) { 237 void EraseIf(std::set<Key, Compare, Allocator>& container, Predicate pred) {
237 internal::IterateAndEraseIf(container, pred); 238 internal::IterateAndEraseIf(container, pred);
238 } 239 }
239 240
240 template <class T, class Allocator, class Predicate> 241 template <class Key, class Compare, class Allocator, class Predicate>
241 void EraseIf(std::multiset<T, Allocator>& container, Predicate pred) { 242 void EraseIf(std::multiset<Key, Compare, Allocator>& container,
243 Predicate pred) {
242 internal::IterateAndEraseIf(container, pred); 244 internal::IterateAndEraseIf(container, pred);
243 } 245 }
244 246
245 template <class T, class Allocator, class Predicate> 247 template <class Key,
246 void EraseIf(std::unordered_map<T, Allocator>& container, Predicate pred) { 248 class T,
249 class Hash,
250 class KeyEqual,
251 class Allocator,
252 class Predicate>
253 void EraseIf(std::unordered_map<Key, T, Hash, KeyEqual, Allocator>& container,
254 Predicate pred) {
247 internal::IterateAndEraseIf(container, pred); 255 internal::IterateAndEraseIf(container, pred);
248 } 256 }
249 257
250 template <class T, class Allocator, class Predicate> 258 template <class Key,
251 void EraseIf(std::unordered_multimap<T, Allocator>& container, Predicate pred) { 259 class T,
260 class Hash,
261 class KeyEqual,
262 class Allocator,
263 class Predicate>
264 void EraseIf(
265 std::unordered_multimap<Key, T, Hash, KeyEqual, Allocator>& container,
266 Predicate pred) {
252 internal::IterateAndEraseIf(container, pred); 267 internal::IterateAndEraseIf(container, pred);
253 } 268 }
254 269
255 template <class T, class Allocator, class Predicate> 270 template <class Key,
256 void EraseIf(std::unordered_set<T, Allocator>& container, Predicate pred) { 271 class Hash,
272 class KeyEqual,
273 class Allocator,
274 class Predicate>
275 void EraseIf(std::unordered_set<Key, Hash, KeyEqual, Allocator>& container,
276 Predicate pred) {
257 internal::IterateAndEraseIf(container, pred); 277 internal::IterateAndEraseIf(container, pred);
258 } 278 }
259 279
260 template <class T, class Allocator, class Predicate> 280 template <class Key,
261 void EraseIf(std::unordered_multiset<T, Allocator>& container, Predicate pred) { 281 class Hash,
282 class KeyEqual,
283 class Allocator,
284 class Predicate>
285 void EraseIf(std::unordered_multiset<Key, Hash, KeyEqual, Allocator>& container,
286 Predicate pred) {
262 internal::IterateAndEraseIf(container, pred); 287 internal::IterateAndEraseIf(container, pred);
263 } 288 }
264 289
265 } // namespace base 290 } // namespace base
266 291
267 #endif // BASE_STL_UTIL_H_ 292 #endif // BASE_STL_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/stl_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698