00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef IXE_include_unordered_map_H
00025 #define IXE_include_unordered_map_H
00026
00027 #include "platform.h"
00028
00029 #if defined(HAVE_STD_UNORDERED_MAP)
00030
00031 # include <unordered_map>
00032 # include "hash.h"
00033 using std::unordered_map;
00034 #define BEGIN_NAMESPACE_HASH namespace std {
00035 #define END_NAMESPACE_HASH }
00036
00037 #elif defined(HAVE_TR1_UNORDERED_MAP)
00038
00039 # include <tr1/unordered_map>
00040 # include "hash.h"
00041 using std::tr1::unordered_map;
00042 #define BEGIN_NAMESPACE_HASH namespace std { namespace tr1 {
00043 #define END_NAMESPACE_HASH }}
00044
00045 #else
00046
00047 # if defined(HAVE_EXT_HASH_MAP_SET)
00048
00049 # include <ext/hash_map>
00050 # if __GNUC__ >= 3
00051 using __gnu_cxx::hash_map;
00052 # define BEGIN_NAMESPACE_HASH namespace __gnu_cxx {
00053 # define END_NAMESPACE_HASH }
00054
00055 # else
00056 using std::hash_map;
00057 # endif
00058 # elif (_MSC_VER >= 1400)
00059 # include <hash_map>
00060 using stdext::hash_map;
00061 # define BEGIN_NAMESPACE_HASH namespace stdext {
00062 # define END_NAMESPACE_HASH }
00063
00064 # else
00065 # include <hash_map>
00066 using std::hash_map;
00067 # define BEGIN_NAMESPACE_HASH namespace std {
00068 # define END_NAMESPACE_HASH }
00069
00070 # endif
00071
00072 # include "hash.h"
00073
00074 namespace Tanl {
00075
00076 template<class _Key, class _Tp,
00077 class _Hash = hash<_Key>,
00078 class _Pred = std::equal_to<_Key>,
00079 class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
00080 class unordered_map : public hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>
00081 {
00082 typedef hash_map<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
00083
00084 public:
00085 typedef typename _Base::size_type size_type;
00086 typedef typename _Base::hasher hasher;
00087 typedef typename _Base::key_equal key_equal;
00088 typedef typename _Base::allocator_type allocator_type;
00089
00090 explicit
00091 unordered_map(size_type __n = 10,
00092 const hasher& __hf = hasher(),
00093 const key_equal& __eql = key_equal(),
00094 const allocator_type& __a = allocator_type())
00095 : _Base(__n, __hf, __eql, __a)
00096 { }
00097
00098 template<typename _InputIterator>
00099 unordered_map(_InputIterator __f, _InputIterator __l,
00100 size_type __n = 10,
00101 const hasher& __hf = hasher(),
00102 const key_equal& __eql = key_equal(),
00103 const allocator_type& __a = allocator_type())
00104 : _Base(__f, __l, __n, __hf, __eql, __a)
00105 { }
00106
00107 void rehash(size_type __n) { resize(__n); }
00108 };
00109
00110 }
00111
00112 using Tanl::unordered_map;
00113
00114 #endif
00115
00116 #endif // IXE_include_unordered_map_H