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

Side by Side Diff: Source/wtf/HashTable.h

Issue 256743005: Add removeAll method to sets and maps and use them (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Moved implementation of removeAll to HashTable.h and shared it. Also added it to LinkedHashSet Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/HashSet.h ('k') | Source/wtf/LinkedHashSet.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 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 David Levin <levin@chromium.org> 3 * Copyright (C) 2008 David Levin <levin@chromium.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 { 1270 {
1271 return a.m_impl == b.m_impl; 1271 return a.m_impl == b.m_impl;
1272 } 1272 }
1273 1273
1274 template<typename T, typename U> 1274 template<typename T, typename U>
1275 inline bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTa bleConstIteratorAdapter<T, U>& b) 1275 inline bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTa bleConstIteratorAdapter<T, U>& b)
1276 { 1276 {
1277 return a.m_impl != b.m_impl; 1277 return a.m_impl != b.m_impl;
1278 } 1278 }
1279 1279
1280 template<typename Collection1, typename Collection2>
1281 inline void removeAll(Collection1& collection, const Collection2& toBeRemove d)
1282 {
1283 if (collection.isEmpty() || toBeRemoved.isEmpty())
1284 return;
1285 typedef typename Collection2::const_iterator CollectionIterator;
1286 CollectionIterator end(toBeRemoved.end());
1287 for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it)
1288 collection.remove(*it);
1289 }
1290
1280 } // namespace WTF 1291 } // namespace WTF
1281 1292
1282 #include "wtf/HashIterators.h" 1293 #include "wtf/HashIterators.h"
1283 1294
1284 #endif // WTF_HashTable_h 1295 #endif // WTF_HashTable_h
OLDNEW
« no previous file with comments | « Source/wtf/HashSet.h ('k') | Source/wtf/LinkedHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698