Index: Source/wtf/HashSet.h |
diff --git a/Source/wtf/HashSet.h b/Source/wtf/HashSet.h |
index 090f1cf589c60a5cfb82ec99c8b7ad30e8589f28..02c099f947f128faf32e2ccc739ce199213eafd7 100644 |
--- a/Source/wtf/HashSet.h |
+++ b/Source/wtf/HashSet.h |
@@ -99,6 +99,8 @@ namespace WTF { |
void remove(ValuePeekInType); |
void remove(iterator); |
void clear(); |
+ template<typename Collection> |
+ void removeAll(const Collection& other); |
static bool isValidValue(ValuePeekInType); |
@@ -218,6 +220,18 @@ namespace WTF { |
} |
template<typename T, typename U, typename V, typename W> |
+ template<typename Collection> |
+ inline void HashSet<T, U, V, W>::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, typename U, typename V, typename W> |
inline bool HashSet<T, U, V, W>::isValidValue(ValuePeekInType value) |
{ |
if (ValueTraits::isDeletedValue(value)) |