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 =
false>
45 :
public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
46 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
47 _Hash, __detail::_Mod_range_hashing,
48 __detail::_Default_ranged_hash,
49 __detail::_Prime_rehash_policy,
50 __cache_hash_code, false, true>
52 typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
53 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
54 _Hash, __detail::_Mod_range_hashing,
55 __detail::_Default_ranged_hash,
56 __detail::_Prime_rehash_policy,
57 __cache_hash_code,
false,
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_map(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(),
74 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
77 template<
typename _InputIterator>
78 __unordered_map(_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(),
85 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
88 __unordered_map(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(),
96 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
100 operator=(initializer_list<value_type> __l)
103 this->insert(__l.begin(), __l.end());
108 template<
class _Key,
class _Tp,
109 class _Hash = hash<_Key>,
112 bool __cache_hash_code =
false>
113 class __unordered_multimap
114 :
public _Hashtable<_Key, std::pair<const _Key, _Tp>,
116 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
117 _Hash, __detail::_Mod_range_hashing,
118 __detail::_Default_ranged_hash,
119 __detail::_Prime_rehash_policy,
120 __cache_hash_code, false, false>
122 typedef _Hashtable<_Key, std::pair<const _Key, _Tp>,
124 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
125 _Hash, __detail::_Mod_range_hashing,
126 __detail::_Default_ranged_hash,
127 __detail::_Prime_rehash_policy,
128 __cache_hash_code,
false,
false>
132 typedef typename _Base::value_type value_type;
133 typedef typename _Base::size_type size_type;
134 typedef typename _Base::hasher hasher;
135 typedef typename _Base::key_equal key_equal;
136 typedef typename _Base::allocator_type allocator_type;
139 __unordered_multimap(size_type __n = 10,
140 const hasher& __hf = hasher(),
141 const key_equal& __eql = key_equal(),
142 const allocator_type& __a = allocator_type())
143 : _Base(__n, __hf, __detail::_Mod_range_hashing(),
144 __detail::_Default_ranged_hash(),
145 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
149 template<
typename _InputIterator>
150 __unordered_multimap(_InputIterator __f, _InputIterator __l,
152 const hasher& __hf = hasher(),
153 const key_equal& __eql = key_equal(),
154 const allocator_type& __a = allocator_type())
155 : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
156 __detail::_Default_ranged_hash(),
157 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
160 __unordered_multimap(initializer_list<value_type> __l,
162 const hasher& __hf = hasher(),
163 const key_equal& __eql = key_equal(),
164 const allocator_type& __a = allocator_type())
165 : _Base(__l.
begin(), __l.
end(), __n, __hf,
166 __detail::_Mod_range_hashing(),
167 __detail::_Default_ranged_hash(),
168 __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
171 __unordered_multimap&
172 operator=(initializer_list<value_type> __l)
175 this->insert(__l.begin(), __l.end());
180 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
181 bool __cache_hash_code>
183 swap(__unordered_map<_Key, _Tp, _Hash, _Pred,
184 _Alloc, __cache_hash_code>& __x,
185 __unordered_map<_Key, _Tp, _Hash, _Pred,
186 _Alloc, __cache_hash_code>& __y)
189 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
190 bool __cache_hash_code>
192 swap(__unordered_multimap<_Key, _Tp, _Hash, _Pred,
193 _Alloc, __cache_hash_code>& __x,
194 __unordered_multimap<_Key, _Tp, _Hash, _Pred,
195 _Alloc, __cache_hash_code>& __y)
198 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
199 bool __cache_hash_code>
201 operator==(
const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
202 __cache_hash_code>& __x,
203 const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
204 __cache_hash_code>& __y)
205 {
return __x._M_equal(__y); }
207 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
208 bool __cache_hash_code>
210 operator!=(
const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
211 __cache_hash_code>& __x,
212 const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
213 __cache_hash_code>& __y)
214 {
return !(__x == __y); }
216 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
217 bool __cache_hash_code>
219 operator==(
const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
220 __cache_hash_code>& __x,
221 const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
222 __cache_hash_code>& __y)
223 {
return __x._M_equal(__y); }
225 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc,
226 bool __cache_hash_code>
228 operator!=(
const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
229 __cache_hash_code>& __x,
230 const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
231 __cache_hash_code>& __y)
232 {
return !(__x == __y); }
252 template<
class _Key,
class _Tp,
253 class _Hash = hash<_Key>,
257 :
public __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
259 typedef __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
263 typedef typename _Base::size_type size_type;
264 typedef typename _Base::hasher hasher;
265 typedef typename _Base::key_equal key_equal;
266 typedef typename _Base::allocator_type allocator_type;
270 const hasher& __hf = hasher(),
271 const key_equal& __eql = key_equal(),
272 const allocator_type& __a = allocator_type())
273 : _Base(__n, __hf, __eql, __a)
276 template<
typename _InputIterator>
279 const hasher& __hf = hasher(),
280 const key_equal& __eql = key_equal(),
281 const allocator_type& __a = allocator_type())
282 : _Base(__f, __l, __n, __hf, __eql, __a)
287 const hasher& __hf = hasher(),
288 const key_equal& __eql = key_equal(),
289 const allocator_type& __a = allocator_type())
290 : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
297 this->insert(__l.begin(), __l.end());
320 template<
class _Key,
class _Tp,
325 :
public __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
327 typedef __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
331 typedef typename _Base::size_type size_type;
332 typedef typename _Base::hasher hasher;
333 typedef typename _Base::key_equal key_equal;
334 typedef typename _Base::allocator_type allocator_type;
338 const hasher& __hf = hasher(),
339 const key_equal& __eql = key_equal(),
340 const allocator_type& __a = allocator_type())
341 : _Base(__n, __hf, __eql, __a)
344 template<
typename _InputIterator>
347 const hasher& __hf = hasher(),
348 const key_equal& __eql = key_equal(),
349 const allocator_type& __a = allocator_type())
350 : _Base(__f, __l, __n, __hf, __eql, __a)
355 const hasher& __hf = hasher(),
356 const key_equal& __eql = key_equal(),
357 const allocator_type& __a = allocator_type())
358 : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
365 this->insert(__l.begin(), __l.end());
370 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
376 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
378 swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
379 unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
382 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
384 operator==(
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
385 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
386 {
return __x._M_equal(__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 == __y); }
394 template<
class _Key,
class _Tp,
class _Hash,
class _Pred,
class _Alloc>
396 operator==(
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
397 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
398 {
return __x._M_equal(__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 == __y); }
406 _GLIBCXX_END_NAMESPACE_CONTAINER
Struct holding two objects of arbitrary type.
constexpr const _Tp * begin(initializer_list< _Tp > __ils)
Return an iterator pointing to the first element of the initilizer_list.
A standard container composed of equivalent keys (possibly containing multiple of each key value) tha...
One of the comparison functors.
Primary class template hash.
A standard container composed of unique keys (containing at most one of each key value) that associat...
constexpr const _Tp * end(initializer_list< _Tp > __ils)
Return an iterator pointing to one past the last element of the initilizer_list.
The standard allocator, as per [20.4].Further details: http://gcc.gnu.org/onlinedocs/libstdc++/manual...