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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/HashSet.h ('k') | Source/wtf/LinkedHashSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/HashTable.h
diff --git a/Source/wtf/HashTable.h b/Source/wtf/HashTable.h
index 302920fc28953211ae22de3c5521364b12efc190..41d4397597855cea4132638ff52c38d7e4665aea 100644
--- a/Source/wtf/HashTable.h
+++ b/Source/wtf/HashTable.h
@@ -1277,6 +1277,17 @@ namespace WTF {
return a.m_impl != b.m_impl;
}
+ template<typename Collection1, typename Collection2>
+ inline void removeAll(Collection1& collection, const Collection2& toBeRemoved)
+ {
+ if (collection.isEmpty() || toBeRemoved.isEmpty())
+ return;
+ typedef typename Collection2::const_iterator CollectionIterator;
+ CollectionIterator end(toBeRemoved.end());
+ for (CollectionIterator it(toBeRemoved.begin()); it != end; ++it)
+ collection.remove(*it);
+ }
+
} // namespace WTF
#include "wtf/HashIterators.h"
« 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