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

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
@jwnimmer-tri jwnimmer-tri force-pushed the spaceshipspaceshipspaceship branch 2 times, most recently from 88de1ff to 43d188d Compare September 12, 2024 16:28
This ports about 75% of our comparisons to be spelled using three-way
comparison, focusing especially on the code in `common`.
@jwnimmer-tri
Copy link
Collaborator Author

Okay, I'm giving up on this one for now. Ventura XCode is too broken to handle the spaceship.

We can revisit the work in ~2 months after we've dropped Ventura.

@jwnimmer-tri jwnimmer-tri deleted the spaceshipspaceshipspaceship branch September 13, 2024 13:54
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.

1 participant