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