4d4094143d6386da173d2e2d5bffab171fa49b18
1 /********************* */
4 ** Original author: cconway
5 ** Major contributors: mdeters
6 ** Minor contributors (to current version): taking
7 ** This file is part of the CVC4 prototype.
8 ** Copyright (c) 2009-2012 New York University and The University of Iowa
9 ** See the file COPYING in the top-level source directory for licensing
10 ** information.\endverbatim
12 ** \brief [[ Add one-line brief description here ]]
14 ** [[ Add lengthier description here ]]
15 ** \todo document this file
18 #include "cvc4_public.h"
20 #ifndef __CVC4__HASH_H
21 #define __CVC4__HASH_H
23 // in case it's not been declared as a namespace yet
24 namespace __gnu_cxx
{}
26 #include <ext/hash_map>
27 #include <ext/hash_set>
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
35 struct hash
<uint64_t> {
36 size_t operator()(uint64_t v
) const {
39 };/* struct hash<uint64_t> */
40 #endif /* CVC4_NEED_HASH_UINT64_T */
42 }/* __gnu_cxx namespace */
44 // hackish: treat hash stuff as if it were in std namespace
45 namespace std
{ using namespace __gnu_cxx
; }
49 struct StringHashFunction
{
50 size_t operator()(const std::string
& str
) const {
51 return std::hash
<const char*>()(str
.c_str());
53 };/* struct StringHashFunction */
55 template <class T
, class U
, class HashT
= std::hash
<T
>, class HashU
= std::hash
<U
> >
56 struct PairHashFunction
{
57 size_t operator()(const std::pair
<T
, U
>& pr
) const {
58 return HashT()(pr
.first
) ^ HashU()(pr
.second
);
60 };/* struct PairHashFunction */
64 #endif /* __CVC4__HASH_H */