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 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
00163 bool __cache_hash_code>
00164 inline bool
00165 operator==(const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
00166 __cache_hash_code>& __x,
00167 const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
00168 __cache_hash_code>& __y)
00169 { return __x._M_equal(__y); }
00170
00171 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
00172 bool __cache_hash_code>
00173 inline bool
00174 operator!=(const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
00175 __cache_hash_code>& __x,
00176 const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
00177 __cache_hash_code>& __y)
00178 { return !(__x == __y); }
00179
00180 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
00181 bool __cache_hash_code>
00182 inline bool
00183 operator==(const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
00184 __cache_hash_code>& __x,
00185 const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
00186 __cache_hash_code>& __y)
00187 { return __x._M_equal(__y); }
00188
00189 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
00190 bool __cache_hash_code>
00191 inline bool
00192 operator!=(const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
00193 __cache_hash_code>& __x,
00194 const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
00195 __cache_hash_code>& __y)
00196 { return !(__x == __y); }
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216 template<class _Key, class _Tp,
00217 class _Hash = hash<_Key>,
00218 class _Pred = std::equal_to<_Key>,
00219 class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
00220 class unordered_map
00221 : public __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
00222 {
00223 typedef __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
00224
00225 public:
00226 typedef typename _Base::value_type value_type;
00227 typedef typename _Base::size_type size_type;
00228 typedef typename _Base::hasher hasher;
00229 typedef typename _Base::key_equal key_equal;
00230 typedef typename _Base::allocator_type allocator_type;
00231
00232 explicit
00233 unordered_map(size_type __n = 10,
00234 const hasher& __hf = hasher(),
00235 const key_equal& __eql = key_equal(),
00236 const allocator_type& __a = allocator_type())
00237 : _Base(__n, __hf, __eql, __a)
00238 { }
00239
00240 template<typename _InputIterator>
00241 unordered_map(_InputIterator __f, _InputIterator __l,
00242 size_type __n = 10,
00243 const hasher& __hf = hasher(),
00244 const key_equal& __eql = key_equal(),
00245 const allocator_type& __a = allocator_type())
00246 : _Base(__f, __l, __n, __hf, __eql, __a)
00247 { }
00248
00249 unordered_map(unordered_map&& __x)
00250 : _Base(std::forward<_Base>(__x)) { }
00251
00252 unordered_map(initializer_list<value_type> __l,
00253 size_type __n = 10,
00254 const hasher& __hf = hasher(),
00255 const key_equal& __eql = key_equal(),
00256 const allocator_type& __a = allocator_type())
00257 : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
00258 { }
00259
00260 unordered_map&
00261 operator=(unordered_map&& __x)
00262 {
00263
00264
00265 this->clear();
00266 this->swap(__x);
00267 return *this;
00268 }
00269
00270 unordered_map&
00271 operator=(initializer_list<value_type> __l)
00272 {
00273 this->clear();
00274 this->insert(__l.begin(), __l.end());
00275 return *this;
00276 }
00277 };
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297 template<class _Key, class _Tp,
00298 class _Hash = hash<_Key>,
00299 class _Pred = std::equal_to<_Key>,
00300 class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
00301 class unordered_multimap
00302 : public __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
00303 {
00304 typedef __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
00305
00306 public:
00307 typedef typename _Base::value_type value_type;
00308 typedef typename _Base::size_type size_type;
00309 typedef typename _Base::hasher hasher;
00310 typedef typename _Base::key_equal key_equal;
00311 typedef typename _Base::allocator_type allocator_type;
00312
00313 explicit
00314 unordered_multimap(size_type __n = 10,
00315 const hasher& __hf = hasher(),
00316 const key_equal& __eql = key_equal(),
00317 const allocator_type& __a = allocator_type())
00318 : _Base(__n, __hf, __eql, __a)
00319 { }
00320
00321
00322 template<typename _InputIterator>
00323 unordered_multimap(_InputIterator __f, _InputIterator __l,
00324 typename _Base::size_type __n = 0,
00325 const hasher& __hf = hasher(),
00326 const key_equal& __eql = key_equal(),
00327 const allocator_type& __a = allocator_type())
00328 : _Base(__f, __l, __n, __hf, __eql, __a)
00329 { }
00330
00331 unordered_multimap(unordered_multimap&& __x)
00332 : _Base(std::forward<_Base>(__x)) { }
00333
00334 unordered_multimap(initializer_list<value_type> __l,
00335 size_type __n = 10,
00336 const hasher& __hf = hasher(),
00337 const key_equal& __eql = key_equal(),
00338 const allocator_type& __a = allocator_type())
00339 : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
00340 { }
00341
00342 unordered_multimap&
00343 operator=(unordered_multimap&& __x)
00344 {
00345
00346
00347 this->clear();
00348 this->swap(__x);
00349 return *this;
00350 }
00351
00352 unordered_multimap&
00353 operator=(initializer_list<value_type> __l)
00354 {
00355 this->clear();
00356 this->insert(__l.begin(), __l.end());
00357 return *this;
00358 }
00359 };
00360
00361 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
00362 inline void
00363 swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
00364 unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
00365 { __x.swap(__y); }
00366
00367 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
00368 inline void
00369 swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
00370 unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
00371 { __x.swap(__y); }
00372
00373 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
00374 inline bool
00375 operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
00376 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
00377 { return __x._M_equal(__y); }
00378
00379 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
00380 inline bool
00381 operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
00382 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
00383 { return !(__x == __y); }
00384
00385 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
00386 inline bool
00387 operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
00388 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
00389 { return __x._M_equal(__y); }
00390
00391 template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
00392 inline bool
00393 operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
00394 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
00395 { return !(__x == __y); }
00396
00397 _GLIBCXX_END_NESTED_NAMESPACE
00398
00399 #endif