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::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_set(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(), __eql,
00071 std::_Identity<_Value>(), __a)
00072 { }
00073
00074 template<typename _InputIterator>
00075 __unordered_set(_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(), __eql,
00082 std::_Identity<_Value>(), __a)
00083 { }
00084
00085 __unordered_set(const __unordered_set& __x) = default;
00086
00087 __unordered_set(__unordered_set&& __x)
00088 : _Base(std::forward<_Base>(__x)) { }
00089 };
00090
00091 template<class _Value,
00092 class _Hash = hash<_Value>,
00093 class _Pred = std::equal_to<_Value>,
00094 class _Alloc = std::allocator<_Value>,
00095 bool __cache_hash_code = false>
00096 class __unordered_multiset
00097 : public _Hashtable<_Value, _Value, _Alloc,
00098 std::_Identity<_Value>, _Pred,
00099 _Hash, __detail::_Mod_range_hashing,
00100 __detail::_Default_ranged_hash,
00101 __detail::_Prime_rehash_policy,
00102 __cache_hash_code, true, false>
00103 {
00104 typedef _Hashtable<_Value, _Value, _Alloc,
00105 std::_Identity<_Value>, _Pred,
00106 _Hash, __detail::_Mod_range_hashing,
00107 __detail::_Default_ranged_hash,
00108 __detail::_Prime_rehash_policy,
00109 __cache_hash_code, true, 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_multiset(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(), __eql,
00125 std::_Identity<_Value>(), __a)
00126 { }
00127
00128
00129 template<typename _InputIterator>
00130 __unordered_multiset(_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(), __eql,
00137 std::_Identity<_Value>(), __a)
00138 { }
00139
00140 __unordered_multiset(const __unordered_multiset& __x) = default;
00141
00142 __unordered_multiset(__unordered_multiset&& __x)
00143 : _Base(std::forward<_Base>(__x)) { }
00144 };
00145
00146 template<class _Value, class _Hash, class _Pred, class _Alloc,
00147 bool __cache_hash_code>
00148 inline void
00149 swap(__unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __x,
00150 __unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __y)
00151 { __x.swap(__y); }
00152
00153 template<class _Value, class _Hash, class _Pred, class _Alloc,
00154 bool __cache_hash_code>
00155 inline void
00156 swap(__unordered_multiset<_Value, _Hash, _Pred,
00157 _Alloc, __cache_hash_code>& __x,
00158 __unordered_multiset<_Value, _Hash, _Pred,
00159 _Alloc, __cache_hash_code>& __y)
00160 { __x.swap(__y); }
00161
00162 template<class _Value, class _Hash, class _Pred, class _Alloc,
00163 bool __cache_hash_code>
00164 inline bool
00165 operator==(const __unordered_set<_Value, _Hash, _Pred, _Alloc,
00166 __cache_hash_code>& __x,
00167 const __unordered_set<_Value, _Hash, _Pred, _Alloc,
00168 __cache_hash_code>& __y)
00169 { return __x._M_equal(__y); }
00170
00171 template<class _Value, class _Hash, class _Pred, class _Alloc,
00172 bool __cache_hash_code>
00173 inline bool
00174 operator!=(const __unordered_set<_Value, _Hash, _Pred, _Alloc,
00175 __cache_hash_code>& __x,
00176 const __unordered_set<_Value, _Hash, _Pred, _Alloc,
00177 __cache_hash_code>& __y)
00178 { return !(__x == __y); }
00179
00180 template<class _Value, class _Hash, class _Pred, class _Alloc,
00181 bool __cache_hash_code>
00182 inline bool
00183 operator==(const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
00184 __cache_hash_code>& __x,
00185 const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
00186 __cache_hash_code>& __y)
00187 { return __x._M_equal(__y); }
00188
00189 template<class _Value, class _Hash, class _Pred, class _Alloc,
00190 bool __cache_hash_code>
00191 inline bool
00192 operator!=(const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
00193 __cache_hash_code>& __x,
00194 const __unordered_multiset<_Value, _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 template<class _Value,
00214 class _Hash = hash<_Value>,
00215 class _Pred = std::equal_to<_Value>,
00216 class _Alloc = std::allocator<_Value> >
00217 class unordered_set
00218 : public __unordered_set<_Value, _Hash, _Pred, _Alloc>
00219 {
00220 typedef __unordered_set<_Value, _Hash, _Pred, _Alloc> _Base;
00221
00222 public:
00223 typedef typename _Base::value_type value_type;
00224 typedef typename _Base::size_type size_type;
00225 typedef typename _Base::hasher hasher;
00226 typedef typename _Base::key_equal key_equal;
00227 typedef typename _Base::allocator_type allocator_type;
00228
00229 explicit
00230 unordered_set(size_type __n = 10,
00231 const hasher& __hf = hasher(),
00232 const key_equal& __eql = key_equal(),
00233 const allocator_type& __a = allocator_type())
00234 : _Base(__n, __hf, __eql, __a)
00235 { }
00236
00237 template<typename _InputIterator>
00238 unordered_set(_InputIterator __f, _InputIterator __l,
00239 size_type __n = 10,
00240 const hasher& __hf = hasher(),
00241 const key_equal& __eql = key_equal(),
00242 const allocator_type& __a = allocator_type())
00243 : _Base(__f, __l, __n, __hf, __eql, __a)
00244 { }
00245
00246 unordered_set(const unordered_set& __x) = default;
00247
00248 unordered_set(unordered_set&& __x)
00249 : _Base(std::forward<_Base>(__x)) { }
00250
00251 unordered_set(initializer_list<value_type> __l,
00252 size_type __n = 10,
00253 const hasher& __hf = hasher(),
00254 const key_equal& __eql = key_equal(),
00255 const allocator_type& __a = allocator_type())
00256 : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
00257 { }
00258
00259 unordered_set&
00260 operator=(const unordered_set& __x) = default;
00261
00262 unordered_set&
00263 operator=(unordered_set&& __x)
00264 {
00265
00266
00267 this->clear();
00268 this->swap(__x);
00269 return *this;
00270 }
00271
00272 unordered_set&
00273 operator=(initializer_list<value_type> __l)
00274 {
00275 this->clear();
00276 this->insert(__l.begin(), __l.end());
00277 return *this;
00278 }
00279 };
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296 template<class _Value,
00297 class _Hash = hash<_Value>,
00298 class _Pred = std::equal_to<_Value>,
00299 class _Alloc = std::allocator<_Value> >
00300 class unordered_multiset
00301 : public __unordered_multiset<_Value, _Hash, _Pred, _Alloc>
00302 {
00303 typedef __unordered_multiset<_Value, _Hash, _Pred, _Alloc> _Base;
00304
00305 public:
00306 typedef typename _Base::value_type value_type;
00307 typedef typename _Base::size_type size_type;
00308 typedef typename _Base::hasher hasher;
00309 typedef typename _Base::key_equal key_equal;
00310 typedef typename _Base::allocator_type allocator_type;
00311
00312 explicit
00313 unordered_multiset(size_type __n = 10,
00314 const hasher& __hf = hasher(),
00315 const key_equal& __eql = key_equal(),
00316 const allocator_type& __a = allocator_type())
00317 : _Base(__n, __hf, __eql, __a)
00318 { }
00319
00320
00321 template<typename _InputIterator>
00322 unordered_multiset(_InputIterator __f, _InputIterator __l,
00323 typename _Base::size_type __n = 0,
00324 const hasher& __hf = hasher(),
00325 const key_equal& __eql = key_equal(),
00326 const allocator_type& __a = allocator_type())
00327 : _Base(__f, __l, __n, __hf, __eql, __a)
00328 { }
00329
00330 unordered_multiset(const unordered_multiset& __x) = default;
00331
00332 unordered_multiset(unordered_multiset&& __x)
00333 : _Base(std::forward<_Base>(__x)) { }
00334
00335 unordered_multiset(initializer_list<value_type> __l,
00336 size_type __n = 10,
00337 const hasher& __hf = hasher(),
00338 const key_equal& __eql = key_equal(),
00339 const allocator_type& __a = allocator_type())
00340 : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
00341 { }
00342
00343 unordered_multiset&
00344 operator=(const unordered_multiset& __x) = default;
00345
00346 unordered_multiset&
00347 operator=(unordered_multiset&& __x)
00348 {
00349
00350
00351 this->clear();
00352 this->swap(__x);
00353 return *this;
00354 }
00355
00356 unordered_multiset&
00357 operator=(initializer_list<value_type> __l)
00358 {
00359 this->clear();
00360 this->insert(__l.begin(), __l.end());
00361 return *this;
00362 }
00363 };
00364
00365 template<class _Value, class _Hash, class _Pred, class _Alloc>
00366 inline void
00367 swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
00368 unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
00369 { __x.swap(__y); }
00370
00371 template<class _Value, class _Hash, class _Pred, class _Alloc>
00372 inline void
00373 swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
00374 unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
00375 { __x.swap(__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._M_equal(__y); }
00382
00383 template<class _Value, class _Hash, class _Pred, class _Alloc>
00384 inline bool
00385 operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
00386 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
00387 { return !(__x == __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._M_equal(__y); }
00394
00395 template<class _Value, class _Hash, class _Pred, class _Alloc>
00396 inline bool
00397 operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
00398 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
00399 { return !(__x == __y); }
00400
00401 _GLIBCXX_END_NESTED_NAMESPACE
00402
00403 #endif
00404