cvc4-1.4
hash.h
Go to the documentation of this file.
1/********************* */
18#include "cvc4_public.h"
19
20#ifndef __CVC4__HASH_H
21#define __CVC4__HASH_H
22
23// in case it's not been declared as a namespace yet
24namespace __gnu_cxx {}
25
26#include <ext/hash_map>
27#include <ext/hash_set>
28
29namespace __gnu_cxx {
30
31#ifdef CVC4_NEED_HASH_UINT64_T
32// on some versions and architectures of GNU C++, we need a
33// specialization of hash for 64-bit values
34template <>
35struct hash<uint64_t> {
36 size_t operator()(uint64_t v) const {
37 return v;
38 }
39};/* struct hash<uint64_t> */
40#endif /* CVC4_NEED_HASH_UINT64_T */
41
42}/* __gnu_cxx namespace */
43
44// hackish: treat hash stuff as if it were in std namespace
45namespace std { using namespace __gnu_cxx; }
46
47namespace CVC4 {
48
50 size_t operator()(const std::string& str) const {
51 return __gnu_cxx::hash<const char*>()(str.c_str());
52 }
53};/* struct StringHashFunction */
54
55template <class T, class U, class HashT = std::hash<T>, class HashU = std::hash<U> >
57 size_t operator()(const std::pair<T, U>& pr) const {
58 return HashT()(pr.first) ^ HashU()(pr.second);
59 }
60};/* struct PairHashFunction */
61
62}/* CVC4 namespace */
63
64#endif /* __CVC4__HASH_H */
Macros that should be defined everywhere during the building of the libraries and driver binary,...
Definition expr.h:106
STL namespace.
size_t operator()(const std::pair< T, U > &pr) const
Definition hash.h:57
size_t operator()(const std::string &str) const
Definition hash.h:50