aboutsummaryrefslogtreecommitdiff
path: root/zenutil
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2022-05-20 12:42:56 +0200
committerStefan Boberg <[email protected]>2022-05-20 12:42:56 +0200
commit5b271be0169b842cdc3d576e48bf0ddc2f122852 (patch)
tree16f501d2190f19a7281ce3f30365817464e146cb /zenutil
parentAdded ZEN_USE_CATCH2 define (diff)
parentfix mac compilation error (diff)
downloadzen-5b271be0169b842cdc3d576e48bf0ddc2f122852.tar.xz
zen-5b271be0169b842cdc3d576e48bf0ddc2f122852.zip
Merge branch 'main' into use-catch2
Diffstat (limited to 'zenutil')
-rw-r--r--zenutil/include/zenutil/cache/cachekey.h31
1 files changed, 11 insertions, 20 deletions
diff --git a/zenutil/include/zenutil/cache/cachekey.h b/zenutil/include/zenutil/cache/cachekey.h
index aa649b4dc..9adde8fc7 100644
--- a/zenutil/include/zenutil/cache/cachekey.h
+++ b/zenutil/include/zenutil/cache/cachekey.h
@@ -17,28 +17,19 @@ struct CacheKey
static CacheKey Create(std::string_view Bucket, const IoHash& Hash) { return {.Bucket = ToLower(Bucket), .Hash = Hash}; }
- static const CacheKey Empty;
-};
-
-inline bool
-operator==(const CacheKey& A, const CacheKey& B)
-{
- return A.Bucket == B.Bucket && A.Hash == B.Hash;
-}
+ auto operator<=>(const CacheKey& that) const
+ {
+ if (auto b = caseSensitiveCompareStrings(Bucket, that.Bucket); b != std::strong_ordering::equal)
+ {
+ return b;
+ }
+ return Hash <=> that.Hash;
+ }
-inline bool
-operator!=(const CacheKey& A, const CacheKey& B)
-{
- return A.Bucket != B.Bucket || A.Hash != B.Hash;
-}
+ auto operator==(const CacheKey& that) const { return (*this <=> that) == std::strong_ordering::equal; }
-inline bool
-operator<(const CacheKey& A, const CacheKey& B)
-{
- const std::string& BucketA = A.Bucket;
- const std::string& BucketB = B.Bucket;
- return BucketA == BucketB ? A.Hash < B.Hash : BucketA < BucketB;
-}
+ static const CacheKey Empty;
+};
struct CacheChunkRequest
{