-
Notifications
You must be signed in to change notification settings - Fork 36
Add support for c++20 spaceship operator <=> #328
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
Conversation
|
@chfast I've no idea why gcc-santizers failing in tests, unrelated to this PR |
|
Please rebase your PR. The CI build issue should be resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this work.
The main motivation for this is to make usage like below compile and work as expected.
struct W
{
intx::uint256 v;
friend auto operator<=>(W, W) = default;
};See https://godbolt.org/z/aq6TEjqqs for editable examples.
This doesn't work however. I believe the reason is that using int as the result type has some limiting effects. We probably should return std::strong_ordering. Maybe reading more of the C++ reference can clarify this.
At least, please add some unit tests like in these examples and try returning std::strong_ordering.
|
@chfast, thanks for the review. |
|
|
Thanks a lot. |



Extend
uinttypes with support for three-way comparison operator (<=>).Closes #295.