CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
hash_combine.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_hash_combine_h
2 #define FWCore_Utilities_hash_combine_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Utilities
6 // Class : hash_combine
7 //
20 // system include files
21 #include <functional>
22 
23 namespace edm {
24  template <typename T>
25  inline void hash_combine(std::size_t& seed, const T& val) {
26  seed ^= std::hash<T>()(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
27  }
28 
29  template <typename T, typename... Types>
30  inline void hash_combine(std::size_t& seed, const T& val, const Types&... args) {
31  hash_combine(seed, val);
32  hash_combine(seed, args...);
33  }
34 
35  template <typename... Types>
36  inline std::size_t hash_value(const Types&... args) {
37  std::size_t seed{0};
38  hash_combine(seed, args...);
39  return seed;
40  }
41 
42 } // namespace edm
43 #endif
std::size_t hash_value(const Types &...args)
Definition: hash_combine.h:36
void hash_combine(std::size_t &seed, const T &val)
Definition: hash_combine.h:25
long double T