From 6c3eae219d3a9a3e565227d00c8e0bcd3db19395 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 30 May 2024 11:14:44 -0700 Subject: [PATCH] Remove duplicated operator<=> --- KeyCompare.h | 7 +++++-- VersionedMap.cpp | 12 ------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/KeyCompare.h b/KeyCompare.h index 9bd374b..f55cb11 100644 --- a/KeyCompare.h +++ b/KeyCompare.h @@ -8,8 +8,10 @@ #include using String = std::basic_string; -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) { diff --git a/VersionedMap.cpp b/VersionedMap.cpp index b1210d5..bc5657e 100644 --- a/VersionedMap.cpp +++ b/VersionedMap.cpp @@ -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