Euphoria
hash.h
Go to the documentation of this file.
1#pragma once
2
3namespace eu::core
4{
5
26{
27 std::size_t result = 17;
28
37 template<typename T>
39 {
40 result = result * 31 + std::hash<T>{}(t);
41 return *this;
42 }
43};
44
45
51#define HASH_DEF_BEGIN(TYPE) \
52 template<> \
53 struct std::hash<TYPE> \
54 { \
55 std::size_t operator()(const TYPE& x) const \
56 { \
57 return eu::core::HashCombiner \
58 { \
59 }
60
70#define HASH_DEF(NAME) .combine(x.NAME)
71
79#define HASH_DEF_END() \
80 .result; \
81 } \
82 } \
83 ;
84
89} // namespace klotter
90
A (inclusive) range between two values.
Definition range.h:19
A utility for combining hash values of multiple objects into a single hash value.
Definition hash.h:26
std::size_t result
Definition hash.h:27
HashCombiner & combine(const T &t)
Combines the hash of the given object with the current result.
Definition hash.h:38