00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef _TR1_UNORDERED_MAP
00035 #define _TR1_UNORDERED_MAP 1
00036
00037 #include <tr1/hashtable>
00038 #include <tr1/functional_hash.h>
00039
00040 namespace std
00041 {
00042 _GLIBCXX_BEGIN_NAMESPACE(tr1)
00043
00044
00045
00046 template<class _Key, class _Tp,
00047 class _Hash = hash<_Key>,
00048 class _Pred = std::equal_to<_Key>,
00049 class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,
00050 bool __cache_hash_code = false>
00051 class unordered_map
00052 : public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
00053 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
00054 _Hash, __detail::_Mod_range_hashing,
00055 __detail::_Default_ranged_hash,
00056 __detail::_Prime_rehash_policy,
00057 __cache_hash_code, false, true>
00058 {
00059 typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
00060 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
00061 _Hash, __detail::_Mod_range_hashing,
00062 __detail::_Default_ranged_hash,
00063 __detail::_Prime_rehash_policy,
00064 __cache_hash_code, false, true>
00065 _Base;
00066
00067 public:
00068 typedef typename _Base::size_type size_type;
00069 typedef typename _Base::hasher hasher;
00070 typedef typename _Base::key_equal key_equal;
00071 typedef typename _Base::allocator_type allocator_type;
00072
00073 explicit
00074 unordered_map(size_type __n = 10,
00075 const hasher& __hf = hasher(),
00076 const key_equal& __eql = key_equal(),
00077 const allocator_type& __a = allocator_type())
00078 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
00079 __detail::_Default_ranged_hash(),
00080 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
00081 { }
00082
00083 template<typename _InputIterator>
00084 unordered_map(_InputIterator __f, _InputIterator __l,
00085 size_type __n = 10,
00086 const hasher& __hf = hasher(),
00087 const key_equal& __eql = key_equal(),
00088 const allocator_type& __a = allocator_type())
00089 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
00090 __detail::_Default_ranged_hash(),
00091 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
00092 { }
00093 };
00094
00095 template<class _Key, class _Tp,
00096 class _Hash = hash<_Key>,
00097 class _Pred = std::equal_to<_Key>,
00098 class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,
00099 bool __cache_hash_code = false>
00100 class unordered_multimap
00101 : public _Hashtable<_Key, std::pair<const _Key, _Tp>,
00102 _Alloc,
00103 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
00104 _Hash, __detail::_Mod_range_hashing,
00105 __detail::_Default_ranged_hash,
00106 __detail::_Prime_rehash_policy,
00107 __cache_hash_code, false, false>
00108 {
00109 typedef _Hashtable<_Key, std::pair<const _Key, _Tp>,
00110 _Alloc,
00111 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
00112 _Hash, __detail::_Mod_range_hashing,
00113 __detail::_Default_ranged_hash,
00114 __detail::_Prime_rehash_policy,
00115 __cache_hash_code, false, false>
00116 _Base;
00117
00118 public:
00119 typedef typename _Base::size_type size_type;
00120 typedef typename _Base::hasher hasher;
00121 typedef typename _Base::key_equal key_equal;
00122 typedef typename _Base::allocator_type allocator_type;
00123
00124 explicit
00125 unordered_multimap(size_type __n = 10,
00126 const hasher& __hf = hasher(),
00127 const key_equal& __eql = key_equal(),
00128 const allocator_type& __a = allocator_type())
00129 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
00130 __detail::_Default_ranged_hash(),
00131 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
00132 { }
00133
00134
00135 template<typename _InputIterator>
00136 unordered_multimap(_InputIterator __f, _InputIterator __l,
00137 typename _Base::size_type __n = 0,
00138 const hasher& __hf = hasher(),
00139 const key_equal& __eql = key_equal(),
00140 const allocator_type& __a = allocator_type())
00141 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
00142 __detail::_Default_ranged_hash(),
00143 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
00144 { }
00145 };
00146
00147 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
00148 bool __cache_hash_code>
00149 inline void
00150 swap(unordered_map<_Key, _Tp, _Hash, _Pred,
00151 _Alloc, __cache_hash_code>& __x,
00152 unordered_map<_Key, _Tp, _Hash, _Pred,
00153 _Alloc, __cache_hash_code>& __y)
00154 { __x.swap(__y); }
00155
00156 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
00157 bool __cache_hash_code>
00158 inline void
00159 swap(unordered_multimap<_Key, _Tp, _Hash, _Pred,
00160 _Alloc, __cache_hash_code>& __x,
00161 unordered_multimap<_Key, _Tp, _Hash, _Pred,
00162 _Alloc, __cache_hash_code>& __y)
00163 { __x.swap(__y); }
00164
00165 _GLIBCXX_END_NAMESPACE
00166 }
00167
00168 #endif // _TR1_UNORDERED_MAP