@@ -17,10 +17,19 @@ namespace hud
1717 {
1818 using key_type = key_t ;
1919
20- // [[nodiscard]] u64 operator()(const key_type &key) const noexcept
21- // {
22- // return hud::hash_64(key);
23- // }
20+ /* * The hasher hash ansichar and wchar with their size. */
21+ template <typename ... type_t >
22+ [[nodiscard]] constexpr hasher_64 &operator ()(const ansichar *value, const usize length) noexcept
23+ {
24+ return hud::hasher_64::hash (value, length).hash (reinterpret_cast <const ansichar *>(&length), sizeof (length));
25+ }
26+
27+ /* * The hasher hash ansichar and wchar with their size. */
28+ template <typename ... type_t >
29+ [[nodiscard]] constexpr hasher_64 &operator ()(const ansichar *value) noexcept
30+ {
31+ return (*this )(value, hud::cstring::length (value));
32+ }
2433 };
2534
2635 template <typename key_t > struct default_equal
@@ -103,7 +112,7 @@ namespace hud
103112
104113 template <
105114 typename slot_t ,
106- typename hash_t ,
115+ typename hasher_t ,
107116 typename key_equal_t ,
108117 typename allocator_t >
109118 class hashmap_impl
@@ -116,7 +125,7 @@ namespace hud
116125 /* * Type of the value. */
117126 using value_type = typename slot_type::value_type;
118127 /* * Type of the hash function. */
119- using hash_type = hash_t ;
128+ using hasher_type = hasher_t ;
120129 /* ***/
121130 using iterator = hud::details::hashmap::iterator<slot_type>;
122131
@@ -136,7 +145,7 @@ namespace hud
136145 {
137146 // TODO: prefetch control bloc
138147 // Hash the key
139- u64 hash = hash_type {}(key);
148+ u64 hash = hasher_type {}(key);
140149 return hud::nullopt ;
141150 }
142151
@@ -175,7 +184,7 @@ namespace hud
175184
176185 public:
177186 /* * Type of the hash function. */
178- using typename super::hash_type ;
187+ using typename super::hasher_type ;
179188 /* * Type of the key. */
180189 using typename super::key_type;
181190 /* * Type of the value. */
0 commit comments