From 4913ca88e5929a59aecd1b5249abfc8542537faf Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Fri, 26 Aug 2022 20:24:57 -0700 Subject: [PATCH] Remove unnecessary std::unary_function base classes The function objects work equally well without them, and the base classes were wrong for both types: * HashForEntry: returns size_t but declared to return hash_t (uint32_t) * EqualityForHashedEntries: returns bool and takes two parameters but declared to return hash_t and take one parameter std::unary_function was deprecated in C++11 and removed in C++17. Upstream libc++ now removes the type for new-enough C++ dialects. Bug: http://b/175635923 Test: treehugger Change-Id: I2ff15c5da6a4e4f71df08c243f8af2f11d8d2b0d --- libutils/include/utils/LruCache.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libutils/include/utils/LruCache.h b/libutils/include/utils/LruCache.h index 36775d0f2..b4243a3db 100644 --- a/libutils/include/utils/LruCache.h +++ b/libutils/include/utils/LruCache.h @@ -84,13 +84,13 @@ private: const TKey& getKey() const final { return key; } }; - struct HashForEntry : public std::unary_function { + struct HashForEntry { size_t operator() (const KeyedEntry* entry) const { return hash_type(entry->getKey()); }; }; - struct EqualityForHashedEntries : public std::unary_function { + struct EqualityForHashedEntries { bool operator() (const KeyedEntry* lhs, const KeyedEntry* rhs) const { return lhs->getKey() == rhs->getKey(); };