Bug 121188

Summary: HashSet should work with move only types
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 ggaren: review+

Anders Carlsson
Reported 2013-09-11 16:00:52 PDT
HashSet should work with move only types
Attachments
Patch (13.31 KB, patch)
2013-09-11 16:10 PDT, Anders Carlsson
ggaren: review+
Anders Carlsson
Comment 1 2013-09-11 16:10:16 PDT
WebKit Commit Bot
Comment 2 2013-09-11 16:27:49 PDT
Attachment 211361 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/HashSet.h', u'Source/WTF/wtf/HashTable.h', u'Tools/ChangeLog', u'Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj', u'Tools/TestWebKitAPI/Tests/MoveOnly.h', u'Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp', u'Tools/TestWebKitAPI/Tests/WTF/Vector.cpp']" exit_code: 1 Source/WTF/wtf/HashTable.h:404: Missing spaces around && [whitespace/operators] [3] Source/WTF/wtf/HashSet.h:77: Missing spaces around && [whitespace/operators] [3] Total errors found: 2 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Geoffrey Garen
Comment 3 2013-09-11 16:32:50 PDT
Comment on attachment 211361 [details] Patch r=me
Anders Carlsson
Comment 4 2013-09-11 16:38:42 PDT
Darin Adler
Comment 5 2013-09-11 16:39:49 PDT
Comment on attachment 211361 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211361&action=review >> Source/WTF/wtf/HashSet.h:77 >> AddResult add(const ValueType&); >> + AddResult add(ValueType&&); > > Missing spaces around && [whitespace/operators] [3] Do we need both of these? Why isn’t the second one alone sufficient? > Source/WTF/wtf/HashTable.h:399 > AddResult add(const ValueType& value) { return add<IdentityTranslatorType>(Extractor::extract(value), value); } > + AddResult add(ValueType&& value) { return add<IdentityTranslatorType>(Extractor::extract(value), std::move(value)); } Do we need both of these? Why isn’t the second one alone sufficient?
Anders Carlsson
Comment 6 2013-09-11 17:05:55 PDT
(In reply to comment #5) > (From update of attachment 211361 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=211361&action=review > > >> Source/WTF/wtf/HashSet.h:77 > >> AddResult add(const ValueType&); > >> + AddResult add(ValueType&&); > > > > Missing spaces around && [whitespace/operators] [3] > > Do we need both of these? Why isn’t the second one alone sufficient? We do need both. Since ValueType is a class template parameter, ValueType&& is only going to bind to rvalues. If ValueType were a member function template parameter, it would be able to bind to both rvalues and rvalues, and then we wouldn’t need the extra overload.
Note You need to log in before you can comment on or make changes to this bug.