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 =
44 __not_<__and_<is_integral<_Value>, is_empty<_Hash>,
45 integral_constant<bool, !__is_final(_Hash)>,
46 __detail::__is_noexcept_hash<_Value, _Hash>>>::value>
48 :
public _Hashtable<_Value, _Value, _Alloc,
49 std::_Identity<_Value>, _Pred,
50 _Hash, __detail::_Mod_range_hashing,
51 __detail::_Default_ranged_hash,
52 __detail::_Prime_rehash_policy,
53 __cache_hash_code, true, true>,
54 __check_copy_constructible<_Alloc>
56 typedef _Hashtable<_Value, _Value, _Alloc,
57 std::_Identity<_Value>, _Pred,
58 _Hash, __detail::_Mod_range_hashing,
59 __detail::_Default_ranged_hash,
60 __detail::_Prime_rehash_policy,
61 __cache_hash_code,
true,
true>
65 typedef typename _Base::value_type value_type;
66 typedef typename _Base::size_type size_type;
67 typedef typename _Base::hasher hasher;
68 typedef typename _Base::key_equal key_equal;
69 typedef typename _Base::allocator_type allocator_type;
70 typedef typename _Base::iterator iterator;
71 typedef typename _Base::const_iterator const_iterator;
74 __unordered_set(size_type __n = 10,
75 const hasher& __hf = hasher(),
76 const key_equal& __eql = key_equal(),
77 const allocator_type& __a = allocator_type())
78 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
79 __detail::_Default_ranged_hash(), __eql,
80 std::_Identity<value_type>(), __a)
83 template<
typename _InputIterator>
84 __unordered_set(_InputIterator __f, _InputIterator __l,
86 const hasher& __hf = hasher(),
87 const key_equal& __eql = key_equal(),
88 const allocator_type& __a = allocator_type())
89 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
90 __detail::_Default_ranged_hash(), __eql,
91 std::_Identity<value_type>(), __a)
94 __unordered_set(initializer_list<value_type> __l,
96 const hasher& __hf = hasher(),
97 const key_equal& __eql = key_equal(),
98 const allocator_type& __a = allocator_type())
99 : _Base(__l.
begin(), __l.
end(), __n, __hf,
100 __detail::_Mod_range_hashing(),
101 __detail::_Default_ranged_hash(), __eql,
102 std::_Identity<value_type>(), __a)
106 operator=(initializer_list<value_type> __l)
109 this->insert(__l.begin(), __l.end());
116 insert(value_type&& __v)
120 insert(const_iterator, value_type&& __v)
121 {
return insert(std::move(__v)).first; }
124 template<
class _Value,
125 class _Hash = hash<_Value>,
128 bool __cache_hash_code =
129 __not_<__and_<is_integral<_Value>, is_empty<_Hash>,
130 integral_constant<bool, !__is_final(_Hash)>,
131 __detail::__is_noexcept_hash<_Value, _Hash>>>::value>
132 class __unordered_multiset
133 :
public _Hashtable<_Value, _Value, _Alloc,
134 std::_Identity<_Value>, _Pred,
135 _Hash, __detail::_Mod_range_hashing,
136 __detail::_Default_ranged_hash,
137 __detail::_Prime_rehash_policy,
138 __cache_hash_code, true, false>,
139 __check_copy_constructible<_Alloc>
141 typedef _Hashtable<_Value, _Value, _Alloc,
142 std::_Identity<_Value>, _Pred,
143 _Hash, __detail::_Mod_range_hashing,
144 __detail::_Default_ranged_hash,
145 __detail::_Prime_rehash_policy,
146 __cache_hash_code,
true,
false>
150 typedef typename _Base::value_type value_type;
151 typedef typename _Base::size_type size_type;
152 typedef typename _Base::hasher hasher;
153 typedef typename _Base::key_equal key_equal;
154 typedef typename _Base::allocator_type allocator_type;
155 typedef typename _Base::iterator iterator;
156 typedef typename _Base::const_iterator const_iterator;
159 __unordered_multiset(size_type __n = 10,
160 const hasher& __hf = hasher(),
161 const key_equal& __eql = key_equal(),
162 const allocator_type& __a = allocator_type())
163 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
164 __detail::_Default_ranged_hash(), __eql,
165 std::_Identity<value_type>(), __a)
169 template<
typename _InputIterator>
170 __unordered_multiset(_InputIterator __f, _InputIterator __l,
172 const hasher& __hf = hasher(),
173 const key_equal& __eql = key_equal(),
174 const allocator_type& __a = allocator_type())
175 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
176 __detail::_Default_ranged_hash(), __eql,
177 std::_Identity<value_type>(), __a)
180 __unordered_multiset(initializer_list<value_type> __l,
182 const hasher& __hf = hasher(),
183 const key_equal& __eql = key_equal(),
184 const allocator_type& __a = allocator_type())
185 : _Base(__l.
begin(), __l.
end(), __n, __hf,
186 __detail::_Mod_range_hashing(),
187 __detail::_Default_ranged_hash(), __eql,
188 std::_Identity<value_type>(), __a)
191 __unordered_multiset&
192 operator=(initializer_list<value_type> __l)
195 this->insert(__l.begin(), __l.end());
202 insert(value_type&& __v)
206 insert(const_iterator, value_type&& __v)
207 {
return insert(std::move(__v)); }
210 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
211 bool __cache_hash_code>
213 swap(__unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __x,
214 __unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __y)
217 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
218 bool __cache_hash_code>
220 swap(__unordered_multiset<_Value, _Hash, _Pred,
221 _Alloc, __cache_hash_code>& __x,
222 __unordered_multiset<_Value, _Hash, _Pred,
223 _Alloc, __cache_hash_code>& __y)
226 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
227 bool __cache_hash_code>
229 operator==(
const __unordered_set<_Value, _Hash, _Pred, _Alloc,
230 __cache_hash_code>& __x,
231 const __unordered_set<_Value, _Hash, _Pred, _Alloc,
232 __cache_hash_code>& __y)
233 {
return __x._M_equal(__y); }
235 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
236 bool __cache_hash_code>
238 operator!=(
const __unordered_set<_Value, _Hash, _Pred, _Alloc,
239 __cache_hash_code>& __x,
240 const __unordered_set<_Value, _Hash, _Pred, _Alloc,
241 __cache_hash_code>& __y)
242 {
return !(__x == __y); }
244 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
245 bool __cache_hash_code>
247 operator==(
const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
248 __cache_hash_code>& __x,
249 const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
250 __cache_hash_code>& __y)
251 {
return __x._M_equal(__y); }
253 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc,
254 bool __cache_hash_code>
256 operator!=(
const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
257 __cache_hash_code>& __x,
258 const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
259 __cache_hash_code>& __y)
260 {
return !(__x == __y); }
277 template<
class _Value,
278 class _Hash = hash<_Value>,
282 :
public __unordered_set<_Value, _Hash, _Pred, _Alloc>
284 typedef __unordered_set<_Value, _Hash, _Pred, _Alloc>
_Base;
287 typedef typename _Base::value_type value_type;
288 typedef typename _Base::size_type size_type;
289 typedef typename _Base::hasher hasher;
290 typedef typename _Base::key_equal key_equal;
291 typedef typename _Base::allocator_type allocator_type;
295 const hasher& __hf = hasher(),
296 const key_equal& __eql = key_equal(),
297 const allocator_type& __a = allocator_type())
298 :
_Base(__n, __hf, __eql, __a)
301 template<
typename _InputIterator>
304 const hasher& __hf = hasher(),
305 const key_equal& __eql = key_equal(),
306 const allocator_type& __a = allocator_type())
307 :
_Base(__f, __l, __n, __hf, __eql, __a)
312 const hasher& __hf = hasher(),
313 const key_equal& __eql = key_equal(),
314 const allocator_type& __a = allocator_type())
315 :
_Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
322 this->insert(__l.begin(), __l.end());
342 template<
class _Value,
347 :
public __unordered_multiset<_Value, _Hash, _Pred, _Alloc>
349 typedef __unordered_multiset<_Value, _Hash, _Pred, _Alloc>
_Base;
352 typedef typename _Base::value_type value_type;
353 typedef typename _Base::size_type size_type;
354 typedef typename _Base::hasher hasher;
355 typedef typename _Base::key_equal key_equal;
356 typedef typename _Base::allocator_type allocator_type;
360 const hasher& __hf = hasher(),
361 const key_equal& __eql = key_equal(),
362 const allocator_type& __a = allocator_type())
363 :
_Base(__n, __hf, __eql, __a)
367 template<
typename _InputIterator>
370 const hasher& __hf = hasher(),
371 const key_equal& __eql = key_equal(),
372 const allocator_type& __a = allocator_type())
373 :
_Base(__f, __l, __n, __hf, __eql, __a)
378 const hasher& __hf = hasher(),
379 const key_equal& __eql = key_equal(),
380 const allocator_type& __a = allocator_type())
381 :
_Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
388 this->insert(__l.begin(), __l.end());
393 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
399 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
401 swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
402 unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
405 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
407 operator==(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
408 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
409 {
return __x._M_equal(__y); }
411 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
413 operator!=(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
414 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
415 {
return !(__x == __y); }
417 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
419 operator==(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
420 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
421 {
return __x._M_equal(__y); }
423 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
425 operator!=(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
426 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
427 {
return !(__x == __y); }
429 _GLIBCXX_END_NAMESPACE_CONTAINER
The standard allocator, as per [20.4].
One of the comparison functors.
A standard container composed of unique keys (containing at most one of each key value) in which the ...
std::_Hashtable< _Value, _Value, _Alloc, std::_Identity< _Value >, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, __cache_hash_code, true, true >
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initilizer_list.
A standard container composed of equivalent keys (possibly containing multiple of each key value) in ...
Struct holding two objects of arbitrary type.
Primary class template hash.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initilizer_list.