diff options
| author | Dan Engelbrecht <[email protected]> | 2022-05-12 10:40:31 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-05-12 10:41:37 +0200 |
| commit | 992f21133f83f6e0a2a99136906cb2e07d6c0842 (patch) | |
| tree | c6097bea3e0a6da924c63f06418b1e83779a0c25 /zenutil/include | |
| parent | manual <=> calls for strings in CacheKey (diff) | |
| download | zen-992f21133f83f6e0a2a99136906cb2e07d6c0842.tar.xz zen-992f21133f83f6e0a2a99136906cb2e07d6c0842.zip | |
Add caseSensitiveCompareStrings and manual <=> and == operator for CacheKey
MacOS clang compiler does not implement a default <=> operator for string
Diffstat (limited to 'zenutil/include')
| -rw-r--r-- | zenutil/include/zenutil/cache/cachekey.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/zenutil/include/zenutil/cache/cachekey.h b/zenutil/include/zenutil/cache/cachekey.h index 569a31441..427c99435 100644 --- a/zenutil/include/zenutil/cache/cachekey.h +++ b/zenutil/include/zenutil/cache/cachekey.h @@ -23,13 +23,19 @@ struct CacheKey auto operator<=>(const CacheKey& that) const { - if (auto cmp = Namespace <=> that.Namespace; cmp != 0) - return cmp; - if (auto cmp = Bucket <=> that.Bucket; cmp != 0) - return cmp; + if (auto n = caseSensitiveCompareStrings(Namespace, that.Namespace); n != std::strong_ordering::equal) + { + return n; + } + if (auto b = caseSensitiveCompareStrings(Bucket, that.Bucket); b != std::strong_ordering::equal) + { + return b; + } return Hash <=> that.Hash; } + auto operator==(const CacheKey& that) const { return (*this <=> that) == std::strong_ordering::equal; } + static const CacheKey Empty; }; |