5 #ifndef HOBBES_UTIL_HASH_H_INCLUDED 6 #define HOBBES_UTIL_HASH_H_INCLUDED 9 #include <unordered_map> 19 static std::hash<T> h;
27 seed ^= hasher(x) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
31 template <std::size_t i,
typename ... Ts>
32 inline typename std::enable_if<i ==
sizeof...(Ts),
void>::type
hashTuple(std::size_t*,
const std::tuple<Ts...>&) {
34 template <std::size_t i,
typename ... Ts>
35 inline typename std::enable_if<i <
sizeof...(Ts),
void>::type
hashTuple(std::size_t*
r,
const std::tuple<Ts...>& ms) {
39 template <
typename ... Ts>
41 inline size_t operator()(
const std::tuple<Ts...>& xs)
const {
49 template <
typename U,
typename V>
51 inline size_t operator()(
const std::pair<U, V>& x)
const {
53 hashAppend<U>(
r, x.first);
54 hashAppend<V>(
r, x.second);
61 struct genHash< std::vector<T> > {
62 inline size_t operator()(
const std::vector<T>& xs)
const {
64 hashAppend<size_t>(
r, xs.size());
65 for (
const auto& x : xs) {
size_t operator()(const T &x) const
Definition: hash.H:18
std::enable_if< i==sizeof...(Ts), void >::type hashTuple(std::size_t *, const std::tuple< Ts... > &)
Definition: hash.H:32
std::pair< std::string, std::string > pair
Definition: str.H:220
size_t r(const reader::MetaData &md, size_t o, T *t)
Definition: storage.H:1730
void hashAppend(std::size_t &seed, const T &x)
Definition: hash.H:25
MonoTypePtr tuple(const MonoTypes &mtys=MonoTypes())
Definition: type.H:1068