Bug 121188 - HashSet should work with move only types
Summary: HashSet should work with move only types
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-11 16:00 PDT by Anders Carlsson
Modified: 2013-09-11 17:05 PDT (History)
4 users (show)

See Also:


Attachments
Patch (13.31 KB, patch)
2013-09-11 16:10 PDT, Anders Carlsson
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2013-09-11 16:00:52 PDT
HashSet should work with move only types
Comment 1 Anders Carlsson 2013-09-11 16:10:16 PDT
Created attachment 211361 [details]
Patch
Comment 2 WebKit Commit Bot 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.
Comment 3 Geoffrey Garen 2013-09-11 16:32:50 PDT
Comment on attachment 211361 [details]
Patch

r=me
Comment 4 Anders Carlsson 2013-09-11 16:38:42 PDT
Committed r155577: <http://trac.webkit.org/changeset/155577>
Comment 5 Darin Adler 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?
Comment 6 Anders Carlsson 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.