Limi
hash.h
1 /*
2  * Copyright 2016, IST Austria
3  *
4  * This file is part of Limi.
5  *
6  * Limi is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Limi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with Limi. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIMI_INTERNAL_HASH_H
21 #define LIMI_INTERNAL_HASH_H
22 
23 #include <ostream>
24 #include <utility>
25 #include "boost.h"
26 
27 namespace std {
28  template<class A, class B> struct hash<pair<A,B>> {
29  inline size_t operator()(const pair<A,B>& val) const {
30  size_t seed = 0;
31  Limi::internal::hash_combine(seed, val.first);
32  Limi::internal::hash_combine(seed, val.second);
33  return seed;
34  }
35  };
36  template<class A, class B> struct equal_to<pair<A,B>> {
37  inline bool operator()(const pair<A,B>& a, const pair<A,B>& b) const {
38  return equal_to<A>()(a.first,b.first) && equal_to<B>()(a.second, b.second);
39  }
40  };
41 }
42 
43 #endif // LIMI_INTERNAL_HASH_H
Definition: generics.h:30