1 /********************* */
4 ** Top contributors (to current version):
5 ** Morgan Deters, Christopher L. Conway, Tim King
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2016 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing 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 __gnu_cxx::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 */