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 #ifndef _UNORDERED_MAP_H
00031 #define _UNORDERED_MAP_H
00032
00033 _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
00034
00035
00036
00037 template<class _Key, class _Tp,
00038 class _Hash = hash<_Key>,
00039 class _Pred = std::equal_to<_Key>,
00040 class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,
00041 bool __cache_hash_code = false>
00042 class __unordered_map
00043 : public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
00044 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
00045 _Hash, __detail::_Mod_range_hashing,
00046 __detail::_Default_ranged_hash,
00047 __detail::_Prime_rehash_policy,
00048 __cache_hash_code, false, true>
00049 {
00050 typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
00051 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
00052 _Hash, __detail::_Mod_range_hashing,
00053 __detail::_Default_ranged_hash,
00054 __detail::_Prime_rehash_policy,
00055 __cache_hash_code, false, true>
00056 _Base;
00057
00058 public:
00059 typedef typename _Base::size_type size_type;
00060 typedef typename _Base::hasher hasher;
00061 typedef typename _Base::key_equal key_equal;
00062 typedef typename _Base::allocator_type allocator_type;
00063
00064 explicit
00065 __unordered_map(size_type __n = 10,
00066 const hasher& __hf = hasher(),
00067 const key_equal& __eql = key_equal(),
00068 const allocator_type& __a = allocator_type())
00069 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
00070 __detail::_Default_ranged_hash(),
00071 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
00072 { }
00073
00074 template<typename _InputIterator>
00075 __unordered_map(_InputIterator __f, _InputIterator __l,
00076 size_type __n = 10,
00077 const hasher& __hf = hasher(),
00078 const key_equal& __eql = key_equal(),
00079 const allocator_type& __a = allocator_type())
00080 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
00081 __detail::_Default_ranged_hash(),
00082 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
00083 { }
00084
00085 __unordered_map(__unordered_map&& __x)
00086 : _Base(std::forward<_Base>(__x)) { }
00087 };
00088
00089 template<class _Key, class _Tp,
00090 class _Hash = hash<_Key>,
00091 class _Pred = std::equal_to<_Key>,
00092 class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,
00093 bool __cache_hash_code = false>
00094 class __unordered_multimap
00095 : public _Hashtable<_Key, std::pair<const _Key, _Tp>,
00096 _Alloc,
00097 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
00098 _Hash, __detail::_Mod_range_hashing,
00099 __detail::_Default_ranged_hash,
00100 __detail::_Prime_rehash_policy,
00101 __cache_hash_code, false, false>
00102 {
00103 typedef _Hashtable<_Key, std::pair<const _Key, _Tp>,
00104 _Alloc,
00105 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
00106 _Hash, __detail::_Mod_range_hashing,
00107 __detail::_Default_ranged_hash,
00108 __detail::_Prime_rehash_policy,
00109 __cache_hash_code, false, false>
00110 _Base;
00111
00112 public:
00113 typedef typename _Base::size_type size_type;
00114 typedef typename _Base::hasher hasher;
00115 typedef typename _Base::key_equal key_equal;
00116 typedef typename _Base::allocator_type allocator_type;
00117
00118 explicit
00119 __unordered_multimap(size_type __n = 10,
00120 const hasher& __hf = hasher(),
00121 const key_equal& __eql = key_equal(),
00122 const allocator_type& __a = allocator_type())
00123 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
00124 __detail::_Default_ranged_hash(),
00125 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
00126 { }
00127
00128
00129 template<typename _InputIterator>
00130 __unordered_multimap(_InputIterator __f, _InputIterator __l,
00131 typename _Base::size_type __n = 0,
00132 const hasher& __hf = hasher(),
00133 const key_equal& __eql = key_equal(),
00134 const allocator_type& __a = allocator_type())
00135 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
00136 __detail::_Default_ranged_hash(),
00137 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
00138 { }
00139
00140 __unordered_multimap(__unordered_multimap&& __x)
00141 : _Base(std::forward<_Base>(__x)) { }
00142 };
00143
00144 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
00145 bool __cache_hash_code>
00146 inline void
00147 swap(__unordered_map<_Key, _Tp, _Hash, _Pred,
00148 _Alloc, __cache_hash_code>& __x,
00149 __unordered_map<_Key, _Tp, _Hash, _Pred,
00150 _Alloc, __cache_hash_code>& __y)
00151 { __x.swap(__y); }
00152
00153 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
00154 bool __cache_hash_code>
00155 inline void
00156 swap(__unordered_multimap<_Key, _Tp, _Hash, _Pred,
00157 _Alloc, __cache_hash_code>& __x,
00158 __unordered_multimap<_Key, _Tp, _Hash, _Pred,
00159 _Alloc, __cache_hash_code>& __y)
00160 { __x.swap(__y); }
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 template<class _Key, class _Tp,
00182 class _Hash = hash<_Key>,
00183 class _Pred = std::equal_to<_Key>,
00184 class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
00185 class unordered_map
00186 : public __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
00187 {
00188 typedef __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
00189
00190 public:
00191 typedef typename _Base::value_type value_type;
00192 typedef typename _Base::size_type size_type;
00193 typedef typename _Base::hasher hasher;
00194 typedef typename _Base::key_equal key_equal;
00195 typedef typename _Base::allocator_type allocator_type;
00196
00197 explicit
00198 unordered_map(size_type __n = 10,
00199 const hasher& __hf = hasher(),
00200 const key_equal& __eql = key_equal(),
00201 const allocator_type& __a = allocator_type())
00202 : _Base(__n, __hf, __eql, __a)
00203 { }
00204
00205 template<typename _InputIterator>
00206 unordered_map(_InputIterator __f, _InputIterator __l,
00207 size_type __n = 10,
00208 const hasher& __hf = hasher(),
00209 const key_equal& __eql = key_equal(),
00210 const allocator_type& __a = allocator_type())
00211 : _Base(__f, __l, __n, __hf, __eql, __a)
00212 { }
00213
00214 unordered_map(unordered_map&& __x)
00215 : _Base(std::forward<_Base>(__x)) { }
00216
00217 unordered_map(initializer_list<value_type> __l,
00218 size_type __n = 10,
00219 const hasher& __hf = hasher(),
00220 const key_equal& __eql = key_equal(),
00221 const allocator_type& __a = allocator_type())
00222 : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
00223 { }
00224
00225 unordered_map&
00226 operator=(unordered_map&& __x)
00227 {
00228
00229
00230 this->clear();
00231 this->swap(__x);
00232 return *this;
00233 }
00234
00235 unordered_map&
00236 operator=(initializer_list<value_type> __l)
00237 {
00238 this->clear();
00239 this->insert(__l.begin(), __l.end());
00240 return *this;
00241 }
00242 };
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 template<class _Key, class _Tp,
00263 class _Hash = hash<_Key>,
00264 class _Pred = std::equal_to<_Key>,
00265 class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
00266 class unordered_multimap
00267 : public __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
00268 {
00269 typedef __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
00270
00271 public:
00272 typedef typename _Base::value_type value_type;
00273 typedef typename _Base::size_type size_type;
00274 typedef typename _Base::hasher hasher;
00275 typedef typename _Base::key_equal key_equal;
00276 typedef typename _Base::allocator_type allocator_type;
00277
00278 explicit
00279 unordered_multimap(size_type __n = 10,
00280 const hasher& __hf = hasher(),
00281 const key_equal& __eql = key_equal(),
00282 const allocator_type& __a = allocator_type())
00283 : _Base(__n, __hf, __eql, __a)
00284 { }
00285
00286
00287 template<typename _InputIterator>
00288 unordered_multimap(_InputIterator __f, _InputIterator __l,
00289 typename _Base::size_type __n = 0,
00290 const hasher& __hf = hasher(),
00291 const key_equal& __eql = key_equal(),
00292 const allocator_type& __a = allocator_type())
00293 : _Base(__f, __l, __n, __hf, __eql, __a)
00294 { }
00295
00296 unordered_multimap(unordered_multimap&& __x)
00297 : _Base(std::forward<_Base>(__x)) { }
00298
00299 unordered_multimap(initializer_list<value_type> __l,
00300 size_type __n = 10,
00301 const hasher& __hf = hasher(),
00302 const key_equal& __eql = key_equal(),
00303 const allocator_type& __a = allocator_type())
00304 : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
00305 { }
00306
00307 unordered_multimap&
00308 operator=(unordered_multimap&& __x)
00309 {
00310
00311
00312 this->clear();
00313 this->swap(__x);
00314 return *this;
00315 }
00316
00317 unordered_multimap&
00318 operator=(initializer_list<value_type> __l)
00319 {
00320 this->clear();
00321 this->insert(__l.begin(), __l.end());
00322 return *this;
00323 }
00324 };
00325
00326 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
00327 inline void
00328 swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
00329 unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
00330 { __x.swap(__y); }
00331
00332 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
00333 inline void
00334 swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
00335 unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
00336 { __x.swap(__y); }
00337
00338 _GLIBCXX_END_NESTED_NAMESPACE
00339
00340 #endif