30 #ifndef _UNORDERED_MAP_H
31 #define _UNORDERED_MAP_H
33 namespace std _GLIBCXX_VISIBILITY(default)
35 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
39 template<
class _Key,
class _Tp,
40 class _Hash = hash<_Key>,
43 bool __cache_hash_code =
44 __not_<__and_<is_integral<_Key>, is_empty<_Hash>,
45 integral_constant<bool, !__is_final(_Hash)>,
46 __detail::__is_noexcept_hash<_Key, _Hash>>>::value>
48 :
public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
49 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
50 _Hash, __detail::_Mod_range_hashing,
51 __detail::_Default_ranged_hash,
52 __detail::_Prime_rehash_policy,
53 __cache_hash_code, false, true>
55 typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
56 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
57 _Hash, __detail::_Mod_range_hashing,
58 __detail::_Default_ranged_hash,
59 __detail::_Prime_rehash_policy,
60 __cache_hash_code,
false,
true>
64 typedef typename _Base::value_type value_type;
65 typedef typename _Base::size_type size_type;
66 typedef typename _Base::hasher hasher;
67 typedef typename _Base::key_equal key_equal;
68 typedef typename _Base::allocator_type allocator_type;
71 __unordered_map(size_type __n = 10,
72 const hasher& __hf = hasher(),
73 const key_equal& __eql = key_equal(),
74 const allocator_type& __a = allocator_type())
75 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
76 __detail::_Default_ranged_hash(),
77 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
80 template<
typename _InputIterator>
81 __unordered_map(_InputIterator __f, _InputIterator __l,
83 const hasher& __hf = hasher(),
84 const key_equal& __eql = key_equal(),
85 const allocator_type& __a = allocator_type())
86 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
87 __detail::_Default_ranged_hash(),
88 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
91 __unordered_map(initializer_list<value_type> __l,
93 const hasher& __hf = hasher(),
94 const key_equal& __eql = key_equal(),
95 const allocator_type& __a = allocator_type())
96 : _Base(__l.
begin(), __l.
end(), __n, __hf,
97 __detail::_Mod_range_hashing(),
98 __detail::_Default_ranged_hash(),
99 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
103 operator=(initializer_list<value_type> __l)
106 this->insert(__l.begin(), __l.end());
111 template<
class _Key,
class _Tp,
112 class _Hash = hash<_Key>,
115 bool __cache_hash_code =
116 __not_<__and_<is_integral<_Key>, is_empty<_Hash>,
117 integral_constant<bool, !__is_final(_Hash)>,
118 __detail::__is_noexcept_hash<_Key, _Hash>>>::value>
119 class __unordered_multimap
120 :
public _Hashtable<_Key, std::pair<const _Key, _Tp>,
122 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
123 _Hash, __detail::_Mod_range_hashing,
124 __detail::_Default_ranged_hash,
125 __detail::_Prime_rehash_policy,
126 __cache_hash_code, false, false>
128 typedef _Hashtable<_Key, std::pair<const _Key, _Tp>,
130 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
131 _Hash, __detail::_Mod_range_hashing,
132 __detail::_Default_ranged_hash,
133 __detail::_Prime_rehash_policy,
134 __cache_hash_code,
false,
false>
138 typedef typename _Base::value_type value_type;
139 typedef typename _Base::size_type size_type;
140 typedef typename _Base::hasher hasher;
141 typedef typename _Base::key_equal key_equal;
142 typedef typename _Base::allocator_type allocator_type;
145 __unordered_multimap(size_type __n = 10,
146 const hasher& __hf = hasher(),
147 const key_equal& __eql = key_equal(),
148 const allocator_type& __a = allocator_type())
149 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
150 __detail::_Default_ranged_hash(),
151 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
155 template<
typename _InputIterator>
156 __unordered_multimap(_InputIterator __f, _InputIterator __l,
158 const hasher& __hf = hasher(),
159 const key_equal& __eql = key_equal(),
160 const allocator_type& __a = allocator_type())
161 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
162 __detail::_Default_ranged_hash(),
163 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
166 __unordered_multimap(initializer_list<value_type> __l,
168 const hasher& __hf = hasher(),
169 const key_equal& __eql = key_equal(),
170 const allocator_type& __a = allocator_type())
171 : _Base(__l.
begin(), __l.
end(), __n, __hf,
172 __detail::_Mod_range_hashing(),
173 __detail::_Default_ranged_hash(),
174 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
177 __unordered_multimap&
178 operator=(initializer_list<value_type> __l)
181 this->insert(__l.begin(), __l.end());
186 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
187 bool __cache_hash_code>
189 swap(__unordered_map<_Key, _Tp, _Hash, _Pred,
190 _Alloc, __cache_hash_code>& __x,
191 __unordered_map<_Key, _Tp, _Hash, _Pred,
192 _Alloc, __cache_hash_code>& __y)
195 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
196 bool __cache_hash_code>
198 swap(__unordered_multimap<_Key, _Tp, _Hash, _Pred,
199 _Alloc, __cache_hash_code>& __x,
200 __unordered_multimap<_Key, _Tp, _Hash, _Pred,
201 _Alloc, __cache_hash_code>& __y)
204 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
205 bool __cache_hash_code>
207 operator==(
const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
208 __cache_hash_code>& __x,
209 const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
210 __cache_hash_code>& __y)
211 {
return __x._M_equal(__y); }
213 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
214 bool __cache_hash_code>
216 operator!=(
const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
217 __cache_hash_code>& __x,
218 const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
219 __cache_hash_code>& __y)
220 {
return !(__x == __y); }
222 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
223 bool __cache_hash_code>
225 operator==(
const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
226 __cache_hash_code>& __x,
227 const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
228 __cache_hash_code>& __y)
229 {
return __x._M_equal(__y); }
231 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
232 bool __cache_hash_code>
234 operator!=(
const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
235 __cache_hash_code>& __x,
236 const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
237 __cache_hash_code>& __y)
238 {
return !(__x == __y); }
258 template<
class _Key,
class _Tp,
259 class _Hash = hash<_Key>,
263 :
public __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
265 typedef __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
_Base;
269 typedef typename _Base::size_type size_type;
270 typedef typename _Base::hasher hasher;
271 typedef typename _Base::key_equal key_equal;
272 typedef typename _Base::allocator_type allocator_type;
276 const hasher& __hf = hasher(),
277 const key_equal& __eql = key_equal(),
278 const allocator_type& __a = allocator_type())
279 :
_Base(__n, __hf, __eql, __a)
282 template<
typename _InputIterator>
285 const hasher& __hf = hasher(),
286 const key_equal& __eql = key_equal(),
287 const allocator_type& __a = allocator_type())
288 :
_Base(__f, __l, __n, __hf, __eql, __a)
293 const hasher& __hf = hasher(),
294 const key_equal& __eql = key_equal(),
295 const allocator_type& __a = allocator_type())
296 :
_Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
303 this->insert(__l.begin(), __l.end());
326 template<
class _Key,
class _Tp,
331 :
public __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
333 typedef __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
_Base;
337 typedef typename _Base::size_type size_type;
338 typedef typename _Base::hasher hasher;
339 typedef typename _Base::key_equal key_equal;
340 typedef typename _Base::allocator_type allocator_type;
344 const hasher& __hf = hasher(),
345 const key_equal& __eql = key_equal(),
346 const allocator_type& __a = allocator_type())
347 :
_Base(__n, __hf, __eql, __a)
350 template<
typename _InputIterator>
353 const hasher& __hf = hasher(),
354 const key_equal& __eql = key_equal(),
355 const allocator_type& __a = allocator_type())
356 :
_Base(__f, __l, __n, __hf, __eql, __a)
361 const hasher& __hf = hasher(),
362 const key_equal& __eql = key_equal(),
363 const allocator_type& __a = allocator_type())
364 :
_Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
371 this->insert(__l.begin(), __l.end());
376 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
382 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
384 swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
385 unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
388 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
390 operator==(
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
391 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
392 {
return __x._M_equal(__y); }
394 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
396 operator!=(
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
397 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
398 {
return !(__x == __y); }
400 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
402 operator==(
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
403 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
404 {
return __x._M_equal(__y); }
406 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
408 operator!=(
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
409 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
410 {
return !(__x == __y); }
412 _GLIBCXX_END_NAMESPACE_CONTAINER