db/view: use operator<=> to define comparison operators
also, there is no need to define operator!=() if operator==() is defined, so drop it. Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <compare>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
|
||||
@@ -28,28 +29,11 @@ struct update_backlog {
|
||||
return float(current) / float(max);
|
||||
}
|
||||
|
||||
friend bool operator==(const update_backlog& lhs, const update_backlog& rhs) {
|
||||
return lhs.relative_size() == rhs.relative_size();
|
||||
std::partial_ordering operator<=>(const update_backlog &rhs) const {
|
||||
return relative_size() <=> rhs.relative_size();
|
||||
}
|
||||
|
||||
friend bool operator<(const update_backlog& lhs, const update_backlog& rhs) {
|
||||
return lhs.relative_size() < rhs.relative_size();
|
||||
}
|
||||
|
||||
friend bool operator!=(const update_backlog& lhs, const update_backlog& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
friend bool operator<=(const update_backlog& lhs, const update_backlog& rhs) {
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
|
||||
friend bool operator>(const update_backlog& lhs, const update_backlog& rhs) {
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
friend bool operator>=(const update_backlog& lhs, const update_backlog& rhs) {
|
||||
return !(lhs < rhs);
|
||||
bool operator==(const update_backlog& rhs) const {
|
||||
return relative_size() == rhs.relative_size();
|
||||
}
|
||||
|
||||
static update_backlog no_backlog() {
|
||||
|
||||
Reference in New Issue
Block a user