Skip to content

Commit

Permalink
Fix prerelease comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui committed Jan 1, 2024
1 parent 0054018 commit 070e0bf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Semver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ bool operator!=(const Prerelease& lhs, const Prerelease& rhs) noexcept {
return !(lhs == rhs);
}
bool operator<(const Prerelease& lhs, const Prerelease& rhs) noexcept {
if (lhs.ident.empty()) {
return false; // lhs is a normal version and is greater
}
if (rhs.ident.empty()) {
return true; // rhs is a normal version and is greater
}
for (usize i = 0; i < lhs.ident.size() && i < rhs.ident.size(); ++i) {
if (lhs.ident[i] < rhs.ident[i]) {
return true;
Expand Down

0 comments on commit 070e0bf

Please sign in to comment.