Bug 121192

Summary: Add HashSet::take
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cmarcelo, commit-queue, darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review+

Anders Carlsson
Reported 2013-09-11 16:58:27 PDT
Add HashSet::take
Attachments
Patch (3.72 KB, patch)
2013-09-11 17:11 PDT, Anders Carlsson
darin: review+
Anders Carlsson
Comment 1 2013-09-11 17:11:01 PDT
WebKit Commit Bot
Comment 2 2013-09-11 17:14:49 PDT
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.
Darin Adler
Comment 3 2013-09-11 17:17:09 PDT
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?
Darin Adler
Comment 4 2013-09-11 17:18:24 PDT
(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().
Anders Carlsson
Comment 5 2013-09-11 17:21:53 PDT
(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.
Darin Adler
Comment 6 2013-09-11 17:24:25 PDT
(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.
Darin Adler
Comment 7 2013-09-11 17:25:48 PDT
It might be nice to have s.takeRandom() or s.takeAny() rather than s.take(s.begin()).
Anders Carlsson
Comment 8 2013-09-11 17:30:07 PDT
Note You need to log in before you can comment on or make changes to this bug.