carl  24.04
Computer ARithmetic Library
hash_util.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <boost/functional/hash.hpp>
4 
5 namespace std {
6 template<typename T>
7 struct hash<std::vector<T>> {
8  std::size_t operator()(const std::vector<T>& v) const {
9  std::size_t seed = 0;
10  std::hash<T> h;
11  for (const auto& t : v)
12  boost::hash_combine(seed, h(t));
13  return seed;
14  }
15 };
16 } // namespace std
void hash_combine(std::size_t &seed, std::size_t value)
Add a value to the given hash seed.
Definition: hash.h:14
std::size_t operator()(const std::vector< T > &v) const
Definition: hash_util.h:8