-
Notifications
You must be signed in to change notification settings - Fork 371
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
Add Version::starts_with and Version::compatible_with #2645
Conversation
auto starts_with_three_way(const T&, const AlwaysEqual&) -> strong_ordering | ||
{ | ||
return strong_ordering::equal; | ||
} |
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.
There is an ambiguity if someone calls starts_with_three_way(AlwaysEqual(), AlwaysEqual());
I guess this combination does not make sense, but it might be worth precising it in a comment to avoid the future definition of a useless overload.
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.
How about adding
[[maybe_unused]] auto starts_with_three_way(const AlwaysEqual&, const AlwaysEqual&) -> strong_ordering {
static_assert(false, "This comparison should not happen with the current implementation.");
}
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.
Even better
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.
It doesn't work since this is not a template, I made a regular assert
.
More
spec::Version
comparison functions needed to implementVersionSpec
.It also removes one level of indentation in
test_version.cpp
, sorry for the big diff.