Index: Source/wtf/ListHashSet.h |
diff --git a/Source/wtf/ListHashSet.h b/Source/wtf/ListHashSet.h |
index f1624dc359e89877301233181e522c994fe237fd..b08057f5e2312a54f7aa20cc1baf1780728a6d38 100644 |
--- a/Source/wtf/ListHashSet.h |
+++ b/Source/wtf/ListHashSet.h |
@@ -156,6 +156,8 @@ namespace WTF { |
void remove(ValuePeekInType); |
void remove(iterator); |
void clear(); |
+ template<typename Collection> |
+ void removeAll(const Collection& other); |
private: |
void unlink(Node*); |
@@ -838,6 +840,18 @@ namespace WTF { |
} |
template<typename T, size_t inlineCapacity, typename U> |
+ template<typename Collection> |
+ inline void ListHashSet<T, inlineCapacity, U>::removeAll(const Collection& other) |
+ { |
+ if (other.isEmpty() || isEmpty()) |
+ return; |
+ typedef typename Collection::const_iterator CollectionIterator; |
+ CollectionIterator otherEnd(other.end()); |
+ for (CollectionIterator it(other.begin()); it != otherEnd; ++it) |
+ remove(*it); |
+ } |
+ |
+ template<typename T, size_t inlineCapacity, typename U> |
void ListHashSet<T, inlineCapacity, U>::unlink(Node* node) |
{ |
if (!node->m_prev) { |