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

replace various comparison operators with spaceship-operator #11

Conversation

annihilatorq
Copy link
Contributor

i decided to use auto operator<=>(const address&) const = default; instead of adding the <=> operator through the MATH_OPERATOR macro to ensure automatic generation of the == and != operators. when specifying a particular return type like std::strong_ordering in the macro, compiler doesn't automatically generate == and != due to the separation of comparison categories in cpp20. using auto with default allows the compiler to deduce the return type and generate all necessary comparison operators, which increases code simplicity and reduces redundancy

Copy link
Owner

@es3n1n es3n1n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, neat idea and looks good overall, tyty
I guess we don't need these macros anymore. Also not sure whether we have tests for operators or not. Will update your PR with these changes in a sec

Copy link
Owner

@es3n1n es3n1n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will merge once CI is green

@es3n1n es3n1n merged commit dfac97b into es3n1n:master Oct 10, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants