This is an archive of the discontinued LLVM Phabricator instance.

Use std::less instead of operator < in less_first and less_second
ClosedPublic

Authored by ahatanak on Aug 25 2021, 3:09 PM.

Details

Summary

According to the standard, if p1 and p2 are both pointers, p1 < p2 and p2 < p1 can both be false in theory in some cases:

https://eel.is/c++draft/expr.rel#4.3

std::less<void> yields a implementation-defined strict total order over pointers:

https://eel.is/c++draft/comparisons.general

Diff Detail

Event Timeline

ahatanak created this revision.Aug 25 2021, 3:09 PM
ahatanak requested review of this revision.Aug 25 2021, 3:09 PM
ldionne accepted this revision.Aug 25 2021, 3:18 PM

I don't know that it makes a difference in practice, but this definitely LGTM on principle.

This revision is now accepted and ready to land.Aug 25 2021, 3:18 PM