Remove duplicated operator<=>

This commit is contained in:
2024-05-30 11:14:44 -07:00
parent 7a7eef2b7d
commit 6c3eae219d
2 changed files with 5 additions and 14 deletions

View File

@@ -8,8 +8,10 @@
#include <string>
using String = std::basic_string<uint8_t>;
inline auto operator<=>(const weaselab::VersionedMap::Key &lhs,
const weaselab::VersionedMap::Key &rhs) {
namespace weaselab {
inline auto operator<=>(const VersionedMap::Key &lhs,
const VersionedMap::Key &rhs) {
int cl = std::min(lhs.len, rhs.len);
if (cl > 0) {
int c = memcmp(lhs.p, rhs.p, cl);
@@ -19,6 +21,7 @@ inline auto operator<=>(const weaselab::VersionedMap::Key &lhs,
}
return lhs.len <=> rhs.len;
}
} // namespace weaselab
inline auto operator<=>(const String &lhs,
const weaselab::VersionedMap::Key &rhs) {

View File

@@ -390,18 +390,6 @@ auto operator<=>(const VersionedMap::Key &lhs, const Node &rhs) {
return lhs.len <=> rhs.entry->keyLen;
}
auto operator<=>(const weaselab::VersionedMap::Key &lhs,
const weaselab::VersionedMap::Key &rhs) {
int cl = std::min(lhs.len, rhs.len);
if (cl > 0) {
int c = memcmp(lhs.p, rhs.p, cl);
if (c != 0) {
return c <=> 0;
}
}
return lhs.len <=> rhs.len;
}
constexpr int orderToInt(std::strong_ordering o) {
return o == std::strong_ordering::less ? -1
: o == std::strong_ordering::equal ? 0