HashSet should work with move only types
Created attachment 211361 [details] Patch
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.
Comment on attachment 211361 [details] Patch r=me
Committed r155577: <http://trac.webkit.org/changeset/155577>
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?
(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.