File indexing completed on 2024-04-06 12:13:12
0001 #ifndef FWCore_Utilities_hash_combine_h
0002 #define FWCore_Utilities_hash_combine_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <functional>
0022
0023 namespace edm {
0024 template <typename T>
0025 inline void hash_combine(std::size_t& seed, const T& val) {
0026 seed ^= std::hash<T>()(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
0027 }
0028
0029 template <typename T, typename... Types>
0030 inline void hash_combine(std::size_t& seed, const T& val, const Types&... args) {
0031 hash_combine(seed, val);
0032 hash_combine(seed, args...);
0033 }
0034
0035 template <typename... Types>
0036 inline std::size_t hash_value(const Types&... args) {
0037 std::size_t seed{0};
0038 hash_combine(seed, args...);
0039 return seed;
0040 }
0041
0042 }
0043 #endif