@@ -162,7 +162,7 @@ struct hash_ops {
162162 static inline bool cmp (const T &a, const T &b) {
163163 return a == b;
164164 }
165- static inline Hasher hash_into (const T &a, Hasher h) {
165+ [[nodiscard]] static inline Hasher hash_into (const T &a, Hasher h) {
166166 if constexpr (std::is_integral_v<T>) {
167167 static_assert (sizeof (T) <= sizeof (uint64_t ));
168168 if (sizeof (T) == sizeof (uint64_t ))
@@ -189,7 +189,7 @@ template<typename P, typename Q> struct hash_ops<std::pair<P, Q>> {
189189 static inline bool cmp (std::pair<P, Q> a, std::pair<P, Q> b) {
190190 return a == b;
191191 }
192- static inline Hasher hash_into (std::pair<P, Q> a, Hasher h) {
192+ [[nodiscard]] static inline Hasher hash_into (std::pair<P, Q> a, Hasher h) {
193193 h = hash_ops<P>::hash_into (a.first , h);
194194 h = hash_ops<Q>::hash_into (a.second , h);
195195 return h;
@@ -217,7 +217,7 @@ template<typename T> struct hash_ops<std::vector<T>> {
217217 static inline bool cmp (std::vector<T> a, std::vector<T> b) {
218218 return a == b;
219219 }
220- static inline Hasher hash_into (std::vector<T> a, Hasher h) {
220+ [[nodiscard]] static inline Hasher hash_into (std::vector<T> a, Hasher h) {
221221 h.eat ((uint32_t )a.size ());
222222 for (auto k : a)
223223 h.eat (k);
@@ -229,7 +229,7 @@ template<typename T, size_t N> struct hash_ops<std::array<T, N>> {
229229 static inline bool cmp (std::array<T, N> a, std::array<T, N> b) {
230230 return a == b;
231231 }
232- static inline Hasher hash_into (std::array<T, N> a, Hasher h) {
232+ [[nodiscard]] static inline Hasher hash_into (std::array<T, N> a, Hasher h) {
233233 for (const auto & k : a)
234234 h = hash_ops<T>::hash_into (k, h);
235235 return h;
@@ -240,7 +240,7 @@ struct hash_cstr_ops {
240240 static inline bool cmp (const char *a, const char *b) {
241241 return strcmp (a, b) == 0 ;
242242 }
243- static inline Hasher hash_into (const char *a, Hasher h) {
243+ [[nodiscard]] static inline Hasher hash_into (const char *a, Hasher h) {
244244 while (*a)
245245 h.hash32 (*(a++));
246246 return h;
@@ -253,7 +253,7 @@ struct hash_ptr_ops {
253253 static inline bool cmp (const void *a, const void *b) {
254254 return a == b;
255255 }
256- static inline Hasher hash_into (const void *a, Hasher h) {
256+ [[nodiscard]] static inline Hasher hash_into (const void *a, Hasher h) {
257257 return hash_ops<uintptr_t >::hash_into ((uintptr_t )a, h);
258258 }
259259};
@@ -263,7 +263,7 @@ struct hash_obj_ops {
263263 return a == b;
264264 }
265265 template <typename T>
266- static inline Hasher hash_into (const T *a, Hasher h) {
266+ [[nodiscard]] static inline Hasher hash_into (const T *a, Hasher h) {
267267 if (a)
268268 h = a->hash_into (h);
269269 else
@@ -295,7 +295,7 @@ template<> struct hash_ops<std::monostate> {
295295 static inline bool cmp (std::monostate a, std::monostate b) {
296296 return a == b;
297297 }
298- static inline Hasher hash_into (std::monostate, Hasher h) {
298+ [[nodiscard]] static inline Hasher hash_into (std::monostate, Hasher h) {
299299 return h;
300300 }
301301};
@@ -304,7 +304,7 @@ template<typename... T> struct hash_ops<std::variant<T...>> {
304304 static inline bool cmp (std::variant<T...> a, std::variant<T...> b) {
305305 return a == b;
306306 }
307- static inline Hasher hash_into (std::variant<T...> a, Hasher h) {
307+ [[nodiscard]] static inline Hasher hash_into (std::variant<T...> a, Hasher h) {
308308 std::visit ([& h](const auto &v) { h.eat (v); }, a);
309309 h.eat (a.index ());
310310 return h;
@@ -315,7 +315,7 @@ template<typename T> struct hash_ops<std::optional<T>> {
315315 static inline bool cmp (std::optional<T> a, std::optional<T> b) {
316316 return a == b;
317317 }
318- static inline Hasher hash_into (std::optional<T> a, Hasher h) {
318+ [[nodiscard]] static inline Hasher hash_into (std::optional<T> a, Hasher h) {
319319 if (a.has_value ())
320320 h.eat (*a);
321321 else
@@ -788,7 +788,7 @@ class dict {
788788 return !operator ==(other);
789789 }
790790
791- Hasher hash_into (Hasher h) const {
791+ [[nodiscard]] Hasher hash_into (Hasher h) const {
792792 for (auto &it : entries) {
793793 Hasher entry_hash;
794794 entry_hash.eat (it.udata .first );
@@ -1158,7 +1158,7 @@ class pool
11581158 return !operator ==(other);
11591159 }
11601160
1161- Hasher hash_into (Hasher h) const {
1161+ [[nodiscard]] Hasher hash_into (Hasher h) const {
11621162 for (auto &it : entries) {
11631163 h.commutative_eat (ops.hash (it.udata ).yield ());
11641164 }
0 commit comments