[webkit-reviews] review granted: [Bug 239481] Use more r-value references for Text / CharacterData classes : [Attachment 457935] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Apr 19 18:25:57 PDT 2022
Sam Weinig <sam at webkit.org> has granted Chris Dumez <cdumez at apple.com>'s
request for review:
Bug 239481: Use more r-value references for Text / CharacterData classes
https://bugs.webkit.org/show_bug.cgi?id=239481
Attachment 457935: Patch
https://bugs.webkit.org/attachment.cgi?id=457935&action=review
--- Comment #6 from Sam Weinig <sam at webkit.org> ---
Comment on attachment 457935
--> https://bugs.webkit.org/attachment.cgi?id=457935
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=457935&action=review
> Source/WebCore/dom/CDATASection.h:32
> + static Ref<CDATASection> create(Document&, String&&);
I have come to the concluding that just using "String", no "&&" is better in
cases like this, and has the same behavior, because it will work for both
l-values and r-values equally well.
If this were a template function, the && would make it a universal reference,
which would be even more general, but not useful for things like this.
The downside of not using "String&&" is that it is harder to find people who
might be doing the wrong thing, which might be a big enough reason to keep &&
in these cases.
More information about the webkit-reviews
mailing list