Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to C++20 spaceship operators #21423

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented May 10, 2024

This ports about 75% of our comparisons to be spelled using https://en.cppreference.com/w/cpp/language/operator_comparison#Three-way_comparison, focusing especially on the code in common.

While reviewing, it might help to remember how operator<=> works:

  • When it is defaulted (= default), you get all 6 comparison functions (i.e., both equality and ordering).
  • When it is defined by hand, you only get the 4 comparison functions (ordering) so still need to write operator== (equality) yourself to get the last two.

This change is Reviewable

@jwnimmer-tri jwnimmer-tri added priority: low release notes: none This pull request should not be mentioned in the release notes labels May 10, 2024
This ports about 75% of our comparisons to be spelled using three-way
comparison, focusing especially on the code in `common`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low release notes: none This pull request should not be mentioned in the release notes status: do not review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant