diff options
| author | Stefan Boberg <[email protected]> | 2025-04-14 17:31:36 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2025-04-14 17:31:36 +0200 |
| commit | 35a95818c3a4ed763d2e8fa56c69062dcb521344 (patch) | |
| tree | d61738572af4912491e77bfe843484ca9bee81cb /src | |
| parent | east deprecation HACK fix (diff) | |
| download | zen-de/vcpkg-latest.tar.xz zen-de/vcpkg-latest.zip | |
fixed predicate for find_as so it works with recent versions of EASTLde/vcpkg-latest
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenstore/cache/cachedisklayer.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/zenstore/cache/cachedisklayer.cpp b/src/zenstore/cache/cachedisklayer.cpp index e548b4b30..4f72a711a 100644 --- a/src/zenstore/cache/cachedisklayer.cpp +++ b/src/zenstore/cache/cachedisklayer.cpp @@ -3571,6 +3571,20 @@ ZenCacheDiskLayer::~ZenCacheDiskLayer() } } +template<typename T, typename U> +struct equal_to_2 +{ + constexpr bool operator()(const T& a, const U& b) const { return a == b; } + + template<typename T_ = T, + typename U_ = U, + typename = eastl::enable_if_t<!eastl::is_same_v<eastl::remove_const_t<T_>, eastl::remove_const_t<U_>>>> + constexpr bool operator()(const U& b, const T& a) const + { + return b == a; + } +}; + ZenCacheDiskLayer::CacheBucket* ZenCacheDiskLayer::GetOrCreateBucket(std::string_view InBucket) { @@ -3578,7 +3592,7 @@ ZenCacheDiskLayer::GetOrCreateBucket(std::string_view InBucket) { RwLock::SharedLockScope SharedLock(m_Lock); - if (auto It = m_Buckets.find(std::string(InBucket)); + if (auto It = m_Buckets.find_as(InBucket, std::hash<std::string_view>(), equal_to_2<std::string, std::string_view>()); It != m_Buckets.end()) { return It->second.get(); @@ -3590,7 +3604,7 @@ ZenCacheDiskLayer::GetOrCreateBucket(std::string_view InBucket) std::unique_ptr<CacheBucket> Bucket(std::make_unique<CacheBucket>(m_Gc, m_TotalMemCachedSize, InBucket, m_Configuration.BucketConfig)); RwLock::ExclusiveLockScope Lock(m_Lock); - if (auto It = m_Buckets.find(std::string(InBucket)); + if (auto It = m_Buckets.find_as(InBucket, std::hash<std::string_view>(), equal_to_2<std::string, std::string_view>()); It != m_Buckets.end()) { return It->second.get(); |