]> sourceware.org Git - systemtap.git/blob - unordered.h
Don't do exelib prelink tests if the system doesn't have prelink.
[systemtap.git] / unordered.h
1 // backward-compatible unordered containers
2 // Copyright (C) 2009 Red Hat Inc.
3 //
4 // This file is part of systemtap, and is free software. You can
5 // redistribute it and/or modify it under the terms of the GNU General
6 // Public License (GPL); either version 2, or (at your option) any
7 // later version.
8
9 #ifndef UNORDERED_H
10 #define UNORDERED_H
11
12 #include "config.h"
13
14 #if 0 // uncomment to force the old mode
15 #undef HAVE_TR1_UNORDERED_MAP
16 #define _BACKWARD_BACKWARD_WARNING_H 1 // defeat deprecation warning
17 #endif
18
19 #ifdef HAVE_TR1_UNORDERED_MAP
20
21 #include <tr1/unordered_map>
22 using std::tr1::unordered_map;
23 using std::tr1::unordered_multimap;
24
25 #include <tr1/unordered_set>
26 using std::tr1::unordered_set;
27 using std::tr1::unordered_multiset;
28
29 #else
30
31 #include <ext/hash_map>
32 #define unordered_map __gnu_cxx::hash_map
33 #define unordered_multimap __gnu_cxx::hash_multimap
34
35 #include <ext/hash_set>
36 #define unordered_set __gnu_cxx::hash_set
37 #define unordered_multiset __gnu_cxx::hash_multiset
38
39 // Hack in common hash functions for strings and raw pointers
40 namespace __gnu_cxx
41 {
42 template<class T> struct hash<T*> {
43 size_t operator() (T* p) const
44 { hash<long> h; return h(reinterpret_cast<long>(p)); }
45 };
46 template<> struct hash<std::string> {
47 size_t operator() (std::string const& s) const
48 { hash<const char*> h; return h(s.c_str()); }
49 };
50 }
51
52 #endif
53
54 #endif // UNORDERED_H
55
56 /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.036058 seconds and 5 git commands to generate.