zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Hash_Map.h
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2  * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3  *
4  * zenilib is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * zenilib is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ZENI_HASH_MAP_H
19 #define ZENI_HASH_MAP_H
20 
21 #include <Zeni/String.h>
22 
23 #ifndef __has_include
24 #define __has_include(x) 0
25 #endif
26 
27 #if __has_include("unordered_map")
28 
29 #include <unordered_map>
30 
31 namespace Zeni {
32 
33  template <typename Key, typename Ty>
34  class Unordered_Map : public std::unordered_map<Key, Ty> {
35  };
36 
37  template <typename Ty>
38  class Unordered_Map<String, Ty> : public std::unordered_map<String, Ty, String::Hash> {
39  };
40 
41 }
42 
43 #elif (__GNUC__ > 3)
44 
45 #include <tr1/unordered_map>
46 
47 namespace Zeni {
48 
49  template <typename Key, typename Ty>
50  class Unordered_Map : public std::tr1::unordered_map<Key, Ty> {
51  };
52 
53  template <typename Ty>
54  class Unordered_Map<String, Ty> : public std::tr1::unordered_map<String, Ty, String::Hash> {
55  };
56 
57 }
58 
59 #elif defined(__GNUC__)
60 
61 #include <ext/hash_map>
62 
63 namespace Zeni {
64 
65  template <typename Key, typename Ty>
66  class Unordered_Map : public __gnu_cxx::hash_map<Key, Ty> {
67  };
68 
69  template <typename Ty>
70  class Unordered_Map<String, Ty> : public __gnu_cxx::hash_map<String, Ty, String::Hash> {
71  };
72 
73 }
74 
75 #else
76 
77 #include <hash_map>
78 
79 namespace Zeni {
80 
81  template <typename Key, typename Ty>
82  class Unordered_Map : public stdext::hash_map<Key, Ty> {
83  };
84 
85  template <typename Ty>
86  class Unordered_Map<String, Ty> : public stdext::hash_map<String, Ty, String::Hash> {
87  };
88 
89 }
90 
91 #endif
92 #endif