]>
sourceware.org Git - systemtap.git/blob - unordered.h
1 // backward-compatible unordered containers
2 // Copyright (C) 2009 Red Hat Inc.
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
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
19 #ifdef HAVE_TR1_UNORDERED_MAP
21 #include <tr1/unordered_map>
22 using std::tr1::unordered_map
;
23 using std::tr1::unordered_multimap
;
25 #include <tr1/unordered_set>
26 using std::tr1::unordered_set
;
27 using std::tr1::unordered_multiset
;
31 #include <ext/hash_map>
32 #define unordered_map __gnu_cxx::hash_map
33 #define unordered_multimap __gnu_cxx::hash_multimap
35 #include <ext/hash_set>
36 #define unordered_set __gnu_cxx::hash_set
37 #define unordered_multiset __gnu_cxx::hash_multiset
39 // Hack in common hash functions for strings and raw pointers
42 template<class T
> struct hash
<T
*> {
43 size_t operator() (T
* p
) const
44 { hash
<long> h
; return h(reinterpret_cast<long>(p
)); }
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()); }
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.