33#ifndef DVD_HASH_MAP_H_
34#define DVD_HASH_MAP_H_
38#include <EASTL/unordered_map.h>
39#include <EASTL/intrusive_hash_map.h>
46 template <
typename Key>
51 template <
typename K,
typename V,
typename HashFun = Div
ide::HashType<K>,
typename Predicate = eastl::equal_to<K>>
54 template <
typename K,
typename V,
typename HashFun = Div
ide::HashType<K>,
typename Predicate = eastl::equal_to<K>>
55 using hashMap = hashAlg::unordered_map<K, V, HashFun, Predicate>;
56 template <
typename K,
typename V,
typename HashFun = Div
ide::HashType<K>,
typename Predicate = eastl::equal_to<K>>
57 using hashPairReturn = hashAlg::pair<typename hashMap<K, V, HashFun, Predicate>::iterator,
bool>;
59 template <
typename K,
typename V>
62 template<
class T,
bool>
67 return hashAlg::hash<T>()(elem);
77 return hashAlg::hash<EnumType>()(
static_cast<EnumType
>(elem));
95 return static_cast<size_t>(elem);
103template <>
struct hash<
std::string>
107 const char* p = x.c_str();
108 uint32_t c = 0u, result = 2166136261U;
110 while ((c =
static_cast<uint8_t
>(*p++)) != 0)
112 result = result * 16777619 ^ c;
115 return static_cast<size_t>(result);
120template <
typename K,
typename V,
typename ... Args,
typename HashFun =
Divide::HashType<K>,
typename Predicate = equal_to<K>>
123 return map.try_emplace(key, eastl::forward<Args>(args)...);
126template <
typename K,
typename V,
typename ... Args,
typename HashFun =
Divide::HashType<K>,
typename Predicate = equal_to<K>>
129 return map.emplace(eastl::forward<Args>(args)...);
132template <
typename K,
typename V,
typename HashFun = Div
ide::HashType<K>,
typename Predicate = equal_to<K>>
135 return map.insert(valuePair);
138template <
typename K,
typename V,
typename HashFun = Div
ide::HashType<K>,
typename Predicate = equal_to<K>>
141 return map.emplace(key, value);
144template <
typename K,
typename V,
typename HashFun = Div
ide::HashType<K>,
typename Predicate = equal_to<K>>
147 return map.emplace(key, eastl::move(value));
Handle console commands that start with a forward slash.
hashAlg::pair< typename hashMap< K, V, HashFun, Predicate >::iterator, bool > hashPairReturn
hashAlg::intrusive_hash_map< K, V, 37 > hashMapIntrusive
hashAlg::unordered_map< K, V, HashFun, Predicate > hashMap
std::underlying_type_t< Type > BaseType
hashAlg::unordered_map< K, V, HashFun, Predicate > hashMapDefaultAlloc
Divide::hashPairReturn< K, V, HashFun > insert(Divide::hashMap< K, V, HashFun, Predicate > &map, const pair< K, V > &valuePair)
Divide::hashPairReturn< K, V, HashFun > emplace(Divide::hashMap< K, V, HashFun, Predicate > &map, K key, Args &&... args)
FORCE_INLINE size_t operator()(const T &elem) const
FORCE_INLINE size_t operator()(const T &elem) const noexcept
FORCE_INLINE size_t operator()(const T &elem)
size_t operator()(const std::string &x) const noexcept