emilib
|
#include <hash_cache.hpp>
Public Member Functions | |
HashCache (T value) noexcept | |
HashCache (const HashCache &other) | |
const HashCache & | operator= (const HashCache &other) |
HashCache (HashCache &&other) noexcept | |
void | operator= (HashCache &&other) noexcept |
void | swap (HashCache &other) noexcept |
const T & | value () const |
std::size_t | hash () const |
operator T () | |
Friends | |
bool | operator== (const HashCache &a, const HashCache &b) |
bool | operator!= (const HashCache &a, const HashCache &b) |
Wraps a value and memoizes the hash of that value. This can be used to speed up std::unoredred_set/unoredred_map or emilib::HashSet/HashMap when calculating the hash of the key is expensive. Example: HashMap<Key, Value> -> HashMap<HashCache<Key>, Value> Example: HashSet<Key, KeyHasher> -> HashSet<HashCache<Key>, HashCacheHasher<KeyHasher>>