30 #ifndef _UNORDERED_SET_H
31 #define _UNORDERED_SET_H
33 namespace std _GLIBCXX_VISIBILITY(default)
35 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
39 template<
class _Value,
40 class _Hash = hash<_Value>,
43 bool __cache_hash_code =
false>
45 :
public _Hashtable<_Value, _Value, _Alloc,
46 std::_Identity<_Value>, _Pred,
47 _Hash, __detail::_Mod_range_hashing,
48 __detail::_Default_ranged_hash,
49 __detail::_Prime_rehash_policy,
50 __cache_hash_code, true, true>
52 typedef _Hashtable<_Value, _Value, _Alloc,
53 std::_Identity<_Value>, _Pred,
54 _Hash, __detail::_Mod_range_hashing,
55 __detail::_Default_ranged_hash,
56 __detail::_Prime_rehash_policy,
57 __cache_hash_code,
true,
true>
61 typedef typename _Base::value_type value_type;
62 typedef typename _Base::size_type size_type;
63 typedef typename _Base::hasher hasher;
64 typedef typename _Base::key_equal key_equal;
65 typedef typename _Base::allocator_type allocator_type;
68 __unordered_set(size_type __n = 10,
69 const hasher& __hf = hasher(),
70 const key_equal& __eql = key_equal(),
71 const allocator_type& __a = allocator_type())
72 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
73 __detail::_Default_ranged_hash(), __eql,
74 std::_Identity<value_type>(), __a)
77 template<
typename _InputIterator>
78 __unordered_set(_InputIterator __f, _InputIterator __l,
80 const hasher& __hf = hasher(),
81 const key_equal& __eql = key_equal(),
82 const allocator_type& __a = allocator_type())
83 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
84 __detail::_Default_ranged_hash(), __eql,
85 std::_Identity<value_type>(), __a)
88 __unordered_set(initializer_list<value_type> __l,
90 const hasher& __hf = hasher(),
91 const key_equal& __eql = key_equal(),
92 const allocator_type& __a = allocator_type())
93 : _Base(__l.
begin(), __l.
end(), __n, __hf,
94 __detail::_Mod_range_hashing(),
95 __detail::_Default_ranged_hash(), __eql,
96 std::_Identity<value_type>(), __a)
100 operator=(initializer_list<value_type> __l)
103 this->insert(__l.begin(), __l.end());
108 template<
class _Value,
109 class _Hash = hash<_Value>,
112 bool __cache_hash_code =
false>
113 class __unordered_multiset
114 :
public _Hashtable<_Value, _Value, _Alloc,
115 std::_Identity<_Value>, _Pred,
116 _Hash, __detail::_Mod_range_hashing,
117 __detail::_Default_ranged_hash,
118 __detail::_Prime_rehash_policy,
119 __cache_hash_code, true, false>
121 typedef _Hashtable<_Value, _Value, _Alloc,
122 std::_Identity<_Value>, _Pred,
123 _Hash, __detail::_Mod_range_hashing,
124 __detail::_Default_ranged_hash,
125 __detail::_Prime_rehash_policy,
126 __cache_hash_code,
true,
false>
130 typedef typename _Base::value_type value_type;
131 typedef typename _Base::size_type size_type;
132 typedef typename _Base::hasher hasher;
133 typedef typename _Base::key_equal key_equal;
134 typedef typename _Base::allocator_type allocator_type;
137 __unordered_multiset(size_type __n = 10,
138 const hasher& __hf = hasher(),
139 const key_equal& __eql = key_equal(),
140 const allocator_type& __a = allocator_type())
141 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
142 __detail::_Default_ranged_hash(), __eql,
143 std::_Identity<value_type>(), __a)
147 template<
typename _InputIterator>
148 __unordered_multiset(_InputIterator __f, _InputIterator __l,
150 const hasher& __hf = hasher(),
151 const key_equal& __eql = key_equal(),
152 const allocator_type& __a = allocator_type())
153 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
154 __detail::_Default_ranged_hash(), __eql,
155 std::_Identity<value_type>(), __a)
158 __unordered_multiset(initializer_list<value_type> __l,
160 const hasher& __hf = hasher(),
161 const key_equal& __eql = key_equal(),
162 const allocator_type& __a = allocator_type())
163 : _Base(__l.
begin(), __l.
end(), __n, __hf,
164 __detail::_Mod_range_hashing(),
165 __detail::_Default_ranged_hash(), __eql,
166 std::_Identity<value_type>(), __a)
169 __unordered_multiset&
170 operator=(initializer_list<value_type> __l)
173 this->insert(__l.begin(), __l.end());
178 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
179 bool __cache_hash_code>
181 swap(__unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __x,
182 __unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __y)
185 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
186 bool __cache_hash_code>
188 swap(__unordered_multiset<_Value, _Hash, _Pred,
189 _Alloc, __cache_hash_code>& __x,
190 __unordered_multiset<_Value, _Hash, _Pred,
191 _Alloc, __cache_hash_code>& __y)
194 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
195 bool __cache_hash_code>
197 operator==(
const __unordered_set<_Value, _Hash, _Pred, _Alloc,
198 __cache_hash_code>& __x,
199 const __unordered_set<_Value, _Hash, _Pred, _Alloc,
200 __cache_hash_code>& __y)
201 {
return __x._M_equal(__y); }
203 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
204 bool __cache_hash_code>
206 operator!=(
const __unordered_set<_Value, _Hash, _Pred, _Alloc,
207 __cache_hash_code>& __x,
208 const __unordered_set<_Value, _Hash, _Pred, _Alloc,
209 __cache_hash_code>& __y)
210 {
return !(__x == __y); }
212 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
213 bool __cache_hash_code>
215 operator==(
const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
216 __cache_hash_code>& __x,
217 const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
218 __cache_hash_code>& __y)
219 {
return __x._M_equal(__y); }
221 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
222 bool __cache_hash_code>
224 operator!=(
const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
225 __cache_hash_code>& __x,
226 const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
227 __cache_hash_code>& __y)
228 {
return !(__x == __y); }
245 template<
class _Value,
246 class _Hash = hash<_Value>,
250 :
public __unordered_set<_Value, _Hash, _Pred, _Alloc>
252 typedef __unordered_set<_Value, _Hash, _Pred, _Alloc> _Base;
255 typedef typename _Base::value_type value_type;
256 typedef typename _Base::size_type size_type;
257 typedef typename _Base::hasher hasher;
258 typedef typename _Base::key_equal key_equal;
259 typedef typename _Base::allocator_type allocator_type;
263 const hasher& __hf = hasher(),
264 const key_equal& __eql = key_equal(),
265 const allocator_type& __a = allocator_type())
266 : _Base(__n, __hf, __eql, __a)
269 template<
typename _InputIterator>
272 const hasher& __hf = hasher(),
273 const key_equal& __eql = key_equal(),
274 const allocator_type& __a = allocator_type())
275 : _Base(__f, __l, __n, __hf, __eql, __a)
280 const hasher& __hf = hasher(),
281 const key_equal& __eql = key_equal(),
282 const allocator_type& __a = allocator_type())
283 : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
290 this->insert(__l.begin(), __l.end());
310 template<
class _Value,
315 :
public __unordered_multiset<_Value, _Hash, _Pred, _Alloc>
317 typedef __unordered_multiset<_Value, _Hash, _Pred, _Alloc> _Base;
320 typedef typename _Base::value_type value_type;
321 typedef typename _Base::size_type size_type;
322 typedef typename _Base::hasher hasher;
323 typedef typename _Base::key_equal key_equal;
324 typedef typename _Base::allocator_type allocator_type;
328 const hasher& __hf = hasher(),
329 const key_equal& __eql = key_equal(),
330 const allocator_type& __a = allocator_type())
331 : _Base(__n, __hf, __eql, __a)
335 template<
typename _InputIterator>
338 const hasher& __hf = hasher(),
339 const key_equal& __eql = key_equal(),
340 const allocator_type& __a = allocator_type())
341 : _Base(__f, __l, __n, __hf, __eql, __a)
346 const hasher& __hf = hasher(),
347 const key_equal& __eql = key_equal(),
348 const allocator_type& __a = allocator_type())
349 : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
356 this->insert(__l.begin(), __l.end());
361 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
367 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
369 swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
370 unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
373 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
375 operator==(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
376 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
377 {
return __x._M_equal(__y); }
379 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
381 operator!=(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
382 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
383 {
return !(__x == __y); }
385 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
387 operator==(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
388 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
389 {
return __x._M_equal(__y); }
391 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
393 operator!=(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
394 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
395 {
return !(__x == __y); }
397 _GLIBCXX_END_NAMESPACE_CONTAINER