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

Add Version::starts_with and Version::compatible_with #2645

Merged
merged 6 commits into from
Jul 3, 2023

Conversation

AntoinePrv
Copy link
Member

@AntoinePrv AntoinePrv commented Jun 30, 2023

More spec::Version comparison functions needed to implement VersionSpec.
It also removes one level of indentation in test_version.cpp, sorry for the big diff.

@AntoinePrv AntoinePrv self-assigned this Jun 30, 2023
libmamba/src/specs/version.cpp Outdated Show resolved Hide resolved
libmamba/src/specs/version.cpp Outdated Show resolved Hide resolved
libmamba/src/specs/version.cpp Show resolved Hide resolved
libmamba/src/specs/version.cpp Show resolved Hide resolved
auto starts_with_three_way(const T&, const AlwaysEqual&) -> strong_ordering
{
return strong_ordering::equal;
}
Copy link
Member

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.

Copy link
Member Author

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.");
}

Copy link
Member

Choose a reason for hiding this comment

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

Even better

Copy link
Member Author

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.

@JohanMabille JohanMabille merged commit cbd8087 into mamba-org:main Jul 3, 2023
@AntoinePrv AntoinePrv deleted the specs-version branch July 3, 2023 12:55
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