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

Missing skills mixin for equality only #63

Open
CelticMinstrel opened this issue Aug 19, 2021 · 2 comments
Open

Missing skills mixin for equality only #63

CelticMinstrel opened this issue Aug 19, 2021 · 2 comments

Comments

@CelticMinstrel
Copy link

You provide Comparable that offers both equality and relational operators, but no skills class that only provides equality.

@stellarpower
Copy link

This would be nice for me, I am wrapping the textbook example class - a matrix. For this, less-than or greater-than doesn't make any sense unless we do so in an explicit manner. However, equating two matrices is a very common operation.

Also, might be mnice to add the new spaceship operator too.

@stellarpower
Copy link

stellarpower commented Jan 6, 2022

I'm also not sure about this:

FLUENT_NODISCARD constexpr bool operator!=(T const& other) const
{
return !(*this == other);
}

I don't think there's anything saying that it would be undefined behaviour if a != b was not equivalent to !(a == b), is there? It could be that a class implements inequality slightly differently from equality. I'd be tempted to use a concept (or equivalent) to check if != is already defined, and only fall back to negating == if that isn't the case, as it's a sensible thing to do.

Edit: I see now it's comparing mathematically, i.e. neither a < b nor b < a, although I still think it might be advantageous to provide for a number of ways to go about htis, as different skills will be required for different use-cases.

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

No branches or pull requests

2 participants