Add HashSet::take
Created attachment 211367 [details] Patch
Attachment 211367 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/HashMap.h', u'Source/WTF/wtf/HashSet.h', u'Tools/ChangeLog', u'Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp']" exit_code: 1 Source/WTF/wtf/HashSet.h:239: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 211367 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211367&action=review In a recent patch I was working on, it was ListHashSet::take that I needed. > Source/WTF/wtf/HashSet.h:238 > + auto HashSet<T, U, V>::take(const ValueType& value) -> ValueType This works in all the compilers we support?
(In reply to comment #3) > In a recent patch I was working on, it was ListHashSet::take that I needed. No, wait, it was HashSet::take, because I wanted to take an element out of a set; I always took the one at begin().
(In reply to comment #3) > This works in all the compilers we support? I think so, it was added in VS2010 and GCC 4.4 (and clang 2.9). (In reply to comment #4) > (In reply to comment #3) > > In a recent patch I was working on, it was ListHashSet::take that I needed. > > No, wait, it was HashSet::take, because I wanted to take an element out of a set; I always took the one at begin(). That makes me think we should add a take(iterator) overload as well.
(In reply to comment #5) > (In reply to comment #4) > > No, wait, it was HashSet::take, because I wanted to take an element out of a set; I always took the one at begin(). > > That makes me think we should add a take(iterator) overload as well. It was a security bug, bug 121033, if you want to look.
It might be nice to have s.takeRandom() or s.takeAny() rather than s.take(s.begin()).
Committed r155580: <http://trac.webkit.org/changeset/155580>