RESOLVED FIXED Bug 234117
Use simpler idioms for std::less and std::greater possible in modern C++
https://bugs.webkit.org/show_bug.cgi?id=234117
Summary Use simpler idioms for std::less and std::greater possible in modern C++
Darin Adler
Reported 2021-12-09 18:06:51 PST
Use simpler idioms for std::less and std::greater possible in modern C++
Attachments
Patch (4.39 KB, patch)
2021-12-09 18:09 PST, Darin Adler
no flags
Patch (4.40 KB, patch)
2021-12-09 20:26 PST, Darin Adler
andersca: review+
Darin Adler
Comment 1 2021-12-09 18:09:21 PST
Darin Adler
Comment 2 2021-12-09 20:26:39 PST
Anders Carlsson
Comment 3 2021-12-10 10:07:35 PST
Comment on attachment 446657 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446657&action=review > Source/WTF/wtf/ListDump.h:124 > + return sortedListDump(list, std::less<>(), comma); Is there a reason why std::less() does not work here? Maybe because it's in an uninstantiated context?
Darin Adler
Comment 4 2021-12-10 10:13:32 PST
Comment on attachment 446657 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446657&action=review >> Source/WTF/wtf/ListDump.h:124 >> + return sortedListDump(list, std::less<>(), comma); > > Is there a reason why std::less() does not work here? Maybe because it's in an uninstantiated context? I know it doesn’t because my earlier patch failed to compile (gcc), but it did seem to compile locally (clang), so it might be a workaround for a gcc bug. I suspect it has something to do with the fact that the comparator argument to sortedListDump is "const Comparator&" and the comparator argument to sort is "Comparator", but the fact that it does seem to work in clang confuses me a bit.
Darin Adler
Comment 5 2021-12-10 10:18:14 PST
Radar WebKit Bug Importer
Comment 6 2021-12-10 10:19:20 PST
Note You need to log in before you can comment on or make changes to this bug.