xref: /dflybsd-src/contrib/gcc-4.7/libstdc++-v3/include/bits/unordered_map.h (revision 81fc95a5293ee307c688a350a3feb4734aaddbb4)
1e4b17023SJohn Marino // unordered_map implementation -*- C++ -*-
2e4b17023SJohn Marino 
3*5ce9237cSJohn Marino // Copyright (C) 2010, 2011, 2013 Free Software Foundation, Inc.
4e4b17023SJohn Marino //
5e4b17023SJohn Marino // This file is part of the GNU ISO C++ Library.  This library is free
6e4b17023SJohn Marino // software; you can redistribute it and/or modify it under the
7e4b17023SJohn Marino // terms of the GNU General Public License as published by the
8e4b17023SJohn Marino // Free Software Foundation; either version 3, or (at your option)
9e4b17023SJohn Marino // any later version.
10e4b17023SJohn Marino 
11e4b17023SJohn Marino // This library is distributed in the hope that it will be useful,
12e4b17023SJohn Marino // but WITHOUT ANY WARRANTY; without even the implied warranty of
13e4b17023SJohn Marino // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14e4b17023SJohn Marino // GNU General Public License for more details.
15e4b17023SJohn Marino 
16e4b17023SJohn Marino // Under Section 7 of GPL version 3, you are granted additional
17e4b17023SJohn Marino // permissions described in the GCC Runtime Library Exception, version
18e4b17023SJohn Marino // 3.1, as published by the Free Software Foundation.
19e4b17023SJohn Marino 
20e4b17023SJohn Marino // You should have received a copy of the GNU General Public License and
21e4b17023SJohn Marino // a copy of the GCC Runtime Library Exception along with this program;
22e4b17023SJohn Marino // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23e4b17023SJohn Marino // <http://www.gnu.org/licenses/>.
24e4b17023SJohn Marino 
25e4b17023SJohn Marino /** @file bits/unordered_map.h
26e4b17023SJohn Marino  *  This is an internal header file, included by other library headers.
27e4b17023SJohn Marino  *  Do not attempt to use it directly. @headername{unordered_map}
28e4b17023SJohn Marino  */
29e4b17023SJohn Marino 
30e4b17023SJohn Marino #ifndef _UNORDERED_MAP_H
31e4b17023SJohn Marino #define _UNORDERED_MAP_H
32e4b17023SJohn Marino 
_GLIBCXX_VISIBILITY(default)33e4b17023SJohn Marino namespace std _GLIBCXX_VISIBILITY(default)
34e4b17023SJohn Marino {
35e4b17023SJohn Marino _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
36e4b17023SJohn Marino 
37e4b17023SJohn Marino   // NB: When we get typedef templates these class definitions
38e4b17023SJohn Marino   // will be unnecessary.
39e4b17023SJohn Marino   template<class _Key, class _Tp,
40e4b17023SJohn Marino 	   class _Hash = hash<_Key>,
41e4b17023SJohn Marino 	   class _Pred = std::equal_to<_Key>,
42e4b17023SJohn Marino 	   class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,
43e4b17023SJohn Marino 	   bool __cache_hash_code =
44e4b17023SJohn Marino 	     __not_<__and_<is_integral<_Key>, is_empty<_Hash>,
45e4b17023SJohn Marino 			   integral_constant<bool, !__is_final(_Hash)>,
46e4b17023SJohn Marino 			   __detail::__is_noexcept_hash<_Key, _Hash>>>::value>
47e4b17023SJohn Marino     class __unordered_map
48e4b17023SJohn Marino     : public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
49e4b17023SJohn Marino 			std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
50e4b17023SJohn Marino 			_Hash, __detail::_Mod_range_hashing,
51e4b17023SJohn Marino 			__detail::_Default_ranged_hash,
52e4b17023SJohn Marino 			__detail::_Prime_rehash_policy,
53*5ce9237cSJohn Marino 			__cache_hash_code, false, true>,
54*5ce9237cSJohn Marino       __check_copy_constructible<_Alloc>
55e4b17023SJohn Marino     {
56e4b17023SJohn Marino       typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
57e4b17023SJohn Marino 			 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
58e4b17023SJohn Marino 			 _Hash, __detail::_Mod_range_hashing,
59e4b17023SJohn Marino 			 __detail::_Default_ranged_hash,
60e4b17023SJohn Marino 			 __detail::_Prime_rehash_policy,
61e4b17023SJohn Marino 			 __cache_hash_code, false, true>
62e4b17023SJohn Marino         _Base;
63e4b17023SJohn Marino 
64e4b17023SJohn Marino     public:
65e4b17023SJohn Marino       typedef typename _Base::value_type      value_type;
66e4b17023SJohn Marino       typedef typename _Base::size_type       size_type;
67e4b17023SJohn Marino       typedef typename _Base::hasher          hasher;
68e4b17023SJohn Marino       typedef typename _Base::key_equal       key_equal;
69e4b17023SJohn Marino       typedef typename _Base::allocator_type  allocator_type;
70e4b17023SJohn Marino 
71e4b17023SJohn Marino       explicit
72e4b17023SJohn Marino       __unordered_map(size_type __n = 10,
73e4b17023SJohn Marino 		      const hasher& __hf = hasher(),
74e4b17023SJohn Marino 		      const key_equal& __eql = key_equal(),
75e4b17023SJohn Marino 		      const allocator_type& __a = allocator_type())
76e4b17023SJohn Marino       : _Base(__n, __hf, __detail::_Mod_range_hashing(),
77e4b17023SJohn Marino 	      __detail::_Default_ranged_hash(),
78e4b17023SJohn Marino 	      __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
79e4b17023SJohn Marino       { }
80e4b17023SJohn Marino 
81e4b17023SJohn Marino       template<typename _InputIterator>
82e4b17023SJohn Marino         __unordered_map(_InputIterator __f, _InputIterator __l,
83e4b17023SJohn Marino 			size_type __n = 0,
84e4b17023SJohn Marino 			const hasher& __hf = hasher(),
85e4b17023SJohn Marino 			const key_equal& __eql = key_equal(),
86e4b17023SJohn Marino 			const allocator_type& __a = allocator_type())
87e4b17023SJohn Marino 	: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
88e4b17023SJohn Marino 		__detail::_Default_ranged_hash(),
89e4b17023SJohn Marino 		__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
90e4b17023SJohn Marino 	{ }
91e4b17023SJohn Marino 
92e4b17023SJohn Marino       __unordered_map(initializer_list<value_type> __l,
93e4b17023SJohn Marino 		      size_type __n = 0,
94e4b17023SJohn Marino 		      const hasher& __hf = hasher(),
95e4b17023SJohn Marino 		      const key_equal& __eql = key_equal(),
96e4b17023SJohn Marino 		      const allocator_type& __a = allocator_type())
97e4b17023SJohn Marino       : _Base(__l.begin(), __l.end(), __n, __hf,
98e4b17023SJohn Marino 	      __detail::_Mod_range_hashing(),
99e4b17023SJohn Marino 	      __detail::_Default_ranged_hash(),
100e4b17023SJohn Marino 	      __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
101e4b17023SJohn Marino       { }
102e4b17023SJohn Marino 
103e4b17023SJohn Marino       __unordered_map&
104e4b17023SJohn Marino       operator=(initializer_list<value_type> __l)
105e4b17023SJohn Marino       {
106e4b17023SJohn Marino 	this->clear();
107e4b17023SJohn Marino 	this->insert(__l.begin(), __l.end());
108e4b17023SJohn Marino 	return *this;
109e4b17023SJohn Marino       }
110e4b17023SJohn Marino     };
111e4b17023SJohn Marino 
112e4b17023SJohn Marino   template<class _Key, class _Tp,
113e4b17023SJohn Marino 	   class _Hash = hash<_Key>,
114e4b17023SJohn Marino 	   class _Pred = std::equal_to<_Key>,
115e4b17023SJohn Marino 	   class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,
116e4b17023SJohn Marino 	   bool __cache_hash_code =
117e4b17023SJohn Marino 	     __not_<__and_<is_integral<_Key>, is_empty<_Hash>,
118e4b17023SJohn Marino 			   integral_constant<bool, !__is_final(_Hash)>,
119e4b17023SJohn Marino 			   __detail::__is_noexcept_hash<_Key, _Hash>>>::value>
120e4b17023SJohn Marino     class __unordered_multimap
121e4b17023SJohn Marino     : public _Hashtable<_Key, std::pair<const _Key, _Tp>,
122e4b17023SJohn Marino 			_Alloc,
123e4b17023SJohn Marino 			std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
124e4b17023SJohn Marino 			_Hash, __detail::_Mod_range_hashing,
125e4b17023SJohn Marino 			__detail::_Default_ranged_hash,
126e4b17023SJohn Marino 			__detail::_Prime_rehash_policy,
127*5ce9237cSJohn Marino 			__cache_hash_code, false, false>,
128*5ce9237cSJohn Marino       __check_copy_constructible<_Alloc>
129e4b17023SJohn Marino     {
130e4b17023SJohn Marino       typedef _Hashtable<_Key, std::pair<const _Key, _Tp>,
131e4b17023SJohn Marino 			 _Alloc,
132e4b17023SJohn Marino 			 std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
133e4b17023SJohn Marino 			 _Hash, __detail::_Mod_range_hashing,
134e4b17023SJohn Marino 			 __detail::_Default_ranged_hash,
135e4b17023SJohn Marino 			 __detail::_Prime_rehash_policy,
136e4b17023SJohn Marino 			 __cache_hash_code, false, false>
137e4b17023SJohn Marino         _Base;
138e4b17023SJohn Marino 
139e4b17023SJohn Marino     public:
140e4b17023SJohn Marino       typedef typename _Base::value_type      value_type;
141e4b17023SJohn Marino       typedef typename _Base::size_type       size_type;
142e4b17023SJohn Marino       typedef typename _Base::hasher          hasher;
143e4b17023SJohn Marino       typedef typename _Base::key_equal       key_equal;
144e4b17023SJohn Marino       typedef typename _Base::allocator_type  allocator_type;
145e4b17023SJohn Marino 
146e4b17023SJohn Marino       explicit
147e4b17023SJohn Marino       __unordered_multimap(size_type __n = 10,
148e4b17023SJohn Marino 			   const hasher& __hf = hasher(),
149e4b17023SJohn Marino 			   const key_equal& __eql = key_equal(),
150e4b17023SJohn Marino 			   const allocator_type& __a = allocator_type())
151e4b17023SJohn Marino       : _Base(__n, __hf, __detail::_Mod_range_hashing(),
152e4b17023SJohn Marino 	      __detail::_Default_ranged_hash(),
153e4b17023SJohn Marino 	      __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
154e4b17023SJohn Marino       { }
155e4b17023SJohn Marino 
156e4b17023SJohn Marino 
157e4b17023SJohn Marino       template<typename _InputIterator>
158e4b17023SJohn Marino         __unordered_multimap(_InputIterator __f, _InputIterator __l,
159e4b17023SJohn Marino 			     size_type __n = 0,
160e4b17023SJohn Marino 			     const hasher& __hf = hasher(),
161e4b17023SJohn Marino 			     const key_equal& __eql = key_equal(),
162e4b17023SJohn Marino 			     const allocator_type& __a = allocator_type())
163e4b17023SJohn Marino 	: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
164e4b17023SJohn Marino 		__detail::_Default_ranged_hash(),
165e4b17023SJohn Marino 		__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
166e4b17023SJohn Marino         { }
167e4b17023SJohn Marino 
168e4b17023SJohn Marino       __unordered_multimap(initializer_list<value_type> __l,
169e4b17023SJohn Marino 			   size_type __n = 0,
170e4b17023SJohn Marino 			   const hasher& __hf = hasher(),
171e4b17023SJohn Marino 			   const key_equal& __eql = key_equal(),
172e4b17023SJohn Marino 			   const allocator_type& __a = allocator_type())
173e4b17023SJohn Marino       : _Base(__l.begin(), __l.end(), __n, __hf,
174e4b17023SJohn Marino 	      __detail::_Mod_range_hashing(),
175e4b17023SJohn Marino 	      __detail::_Default_ranged_hash(),
176e4b17023SJohn Marino 	      __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
177e4b17023SJohn Marino       { }
178e4b17023SJohn Marino 
179e4b17023SJohn Marino       __unordered_multimap&
180e4b17023SJohn Marino       operator=(initializer_list<value_type> __l)
181e4b17023SJohn Marino       {
182e4b17023SJohn Marino 	this->clear();
183e4b17023SJohn Marino 	this->insert(__l.begin(), __l.end());
184e4b17023SJohn Marino 	return *this;
185e4b17023SJohn Marino       }
186e4b17023SJohn Marino     };
187e4b17023SJohn Marino 
188e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
189e4b17023SJohn Marino 	   bool __cache_hash_code>
190e4b17023SJohn Marino     inline void
191e4b17023SJohn Marino     swap(__unordered_map<_Key, _Tp, _Hash, _Pred,
192e4b17023SJohn Marino 	 _Alloc, __cache_hash_code>& __x,
193e4b17023SJohn Marino 	 __unordered_map<_Key, _Tp, _Hash, _Pred,
194e4b17023SJohn Marino 	 _Alloc, __cache_hash_code>& __y)
195e4b17023SJohn Marino     { __x.swap(__y); }
196e4b17023SJohn Marino 
197e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
198e4b17023SJohn Marino 	   bool __cache_hash_code>
199e4b17023SJohn Marino     inline void
200e4b17023SJohn Marino     swap(__unordered_multimap<_Key, _Tp, _Hash, _Pred,
201e4b17023SJohn Marino 	 _Alloc, __cache_hash_code>& __x,
202e4b17023SJohn Marino 	 __unordered_multimap<_Key, _Tp, _Hash, _Pred,
203e4b17023SJohn Marino 	 _Alloc, __cache_hash_code>& __y)
204e4b17023SJohn Marino     { __x.swap(__y); }
205e4b17023SJohn Marino 
206e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
207e4b17023SJohn Marino 	   bool __cache_hash_code>
208e4b17023SJohn Marino     inline bool
209e4b17023SJohn Marino     operator==(const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
210e4b17023SJohn Marino 	       __cache_hash_code>& __x,
211e4b17023SJohn Marino 	       const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
212e4b17023SJohn Marino 	       __cache_hash_code>& __y)
213e4b17023SJohn Marino     { return __x._M_equal(__y); }
214e4b17023SJohn Marino 
215e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
216e4b17023SJohn Marino 	   bool __cache_hash_code>
217e4b17023SJohn Marino     inline bool
218e4b17023SJohn Marino     operator!=(const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
219e4b17023SJohn Marino 	       __cache_hash_code>& __x,
220e4b17023SJohn Marino 	       const __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc,
221e4b17023SJohn Marino 	       __cache_hash_code>& __y)
222e4b17023SJohn Marino     { return !(__x == __y); }
223e4b17023SJohn Marino 
224e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
225e4b17023SJohn Marino 	   bool __cache_hash_code>
226e4b17023SJohn Marino     inline bool
227e4b17023SJohn Marino     operator==(const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
228e4b17023SJohn Marino 	       __cache_hash_code>& __x,
229e4b17023SJohn Marino 	       const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
230e4b17023SJohn Marino 	       __cache_hash_code>& __y)
231e4b17023SJohn Marino     { return __x._M_equal(__y); }
232e4b17023SJohn Marino 
233e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
234e4b17023SJohn Marino 	   bool __cache_hash_code>
235e4b17023SJohn Marino     inline bool
236e4b17023SJohn Marino     operator!=(const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
237e4b17023SJohn Marino 	       __cache_hash_code>& __x,
238e4b17023SJohn Marino 	       const __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc,
239e4b17023SJohn Marino 	       __cache_hash_code>& __y)
240e4b17023SJohn Marino     { return !(__x == __y); }
241e4b17023SJohn Marino 
242e4b17023SJohn Marino   /**
243e4b17023SJohn Marino    *  @brief A standard container composed of unique keys (containing
244e4b17023SJohn Marino    *  at most one of each key value) that associates values of another type
245e4b17023SJohn Marino    *  with the keys.
246e4b17023SJohn Marino    *
247e4b17023SJohn Marino    *  @ingroup unordered_associative_containers
248e4b17023SJohn Marino    *
249e4b17023SJohn Marino    *  Meets the requirements of a <a href="tables.html#65">container</a>, and
250e4b17023SJohn Marino    *  <a href="tables.html#xx">unordered associative container</a>
251e4b17023SJohn Marino    *
252e4b17023SJohn Marino    *  @param  Key  Type of key objects.
253e4b17023SJohn Marino    *  @param  Tp  Type of mapped objects.
254e4b17023SJohn Marino    *  @param  Hash  Hashing function object type, defaults to hash<Value>.
255e4b17023SJohn Marino    *  @param  Pred  Predicate function object type, defaults to equal_to<Value>.
256e4b17023SJohn Marino    *  @param  Alloc  Allocator type, defaults to allocator<Key>.
257e4b17023SJohn Marino    *
258e4b17023SJohn Marino    * The resulting value type of the container is std::pair<const Key, Tp>.
259e4b17023SJohn Marino    */
260e4b17023SJohn Marino   template<class _Key, class _Tp,
261e4b17023SJohn Marino 	   class _Hash = hash<_Key>,
262e4b17023SJohn Marino 	   class _Pred = std::equal_to<_Key>,
263e4b17023SJohn Marino 	   class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
264e4b17023SJohn Marino     class unordered_map
265e4b17023SJohn Marino     : public __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
266e4b17023SJohn Marino     {
267e4b17023SJohn Marino       typedef __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>  _Base;
268e4b17023SJohn Marino 
269e4b17023SJohn Marino     public:
270e4b17023SJohn Marino       typedef typename _Base::value_type      value_type;
271e4b17023SJohn Marino       typedef typename _Base::size_type       size_type;
272e4b17023SJohn Marino       typedef typename _Base::hasher          hasher;
273e4b17023SJohn Marino       typedef typename _Base::key_equal       key_equal;
274e4b17023SJohn Marino       typedef typename _Base::allocator_type  allocator_type;
275e4b17023SJohn Marino 
276e4b17023SJohn Marino       explicit
277e4b17023SJohn Marino       unordered_map(size_type __n = 10,
278e4b17023SJohn Marino 		    const hasher& __hf = hasher(),
279e4b17023SJohn Marino 		    const key_equal& __eql = key_equal(),
280e4b17023SJohn Marino 		    const allocator_type& __a = allocator_type())
281e4b17023SJohn Marino       : _Base(__n, __hf, __eql, __a)
282e4b17023SJohn Marino       { }
283e4b17023SJohn Marino 
284e4b17023SJohn Marino       template<typename _InputIterator>
285e4b17023SJohn Marino         unordered_map(_InputIterator __f, _InputIterator __l,
286e4b17023SJohn Marino 		      size_type __n = 0,
287e4b17023SJohn Marino 		      const hasher& __hf = hasher(),
288e4b17023SJohn Marino 		      const key_equal& __eql = key_equal(),
289e4b17023SJohn Marino 		      const allocator_type& __a = allocator_type())
290e4b17023SJohn Marino 	: _Base(__f, __l, __n, __hf, __eql, __a)
291e4b17023SJohn Marino         { }
292e4b17023SJohn Marino 
293e4b17023SJohn Marino       unordered_map(initializer_list<value_type> __l,
294e4b17023SJohn Marino 		    size_type __n = 0,
295e4b17023SJohn Marino 		    const hasher& __hf = hasher(),
296e4b17023SJohn Marino 		    const key_equal& __eql = key_equal(),
297e4b17023SJohn Marino 		    const allocator_type& __a = allocator_type())
298e4b17023SJohn Marino       : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
299e4b17023SJohn Marino       { }
300e4b17023SJohn Marino 
301e4b17023SJohn Marino       unordered_map&
302e4b17023SJohn Marino       operator=(initializer_list<value_type> __l)
303e4b17023SJohn Marino       {
304e4b17023SJohn Marino 	this->clear();
305e4b17023SJohn Marino 	this->insert(__l.begin(), __l.end());
306e4b17023SJohn Marino 	return *this;
307e4b17023SJohn Marino       }
308e4b17023SJohn Marino     };
309e4b17023SJohn Marino 
310e4b17023SJohn Marino   /**
311e4b17023SJohn Marino    *  @brief A standard container composed of equivalent keys
312e4b17023SJohn Marino    *  (possibly containing multiple of each key value) that associates
313e4b17023SJohn Marino    *  values of another type with the keys.
314e4b17023SJohn Marino    *
315e4b17023SJohn Marino    *  @ingroup unordered_associative_containers
316e4b17023SJohn Marino    *
317e4b17023SJohn Marino    *  Meets the requirements of a <a href="tables.html#65">container</a>, and
318e4b17023SJohn Marino    *  <a href="tables.html#xx">unordered associative container</a>
319e4b17023SJohn Marino    *
320e4b17023SJohn Marino    *  @param  Key  Type of key objects.
321e4b17023SJohn Marino    *  @param  Tp  Type of mapped objects.
322e4b17023SJohn Marino    *  @param  Hash  Hashing function object type, defaults to hash<Value>.
323e4b17023SJohn Marino    *  @param  Pred  Predicate function object type, defaults to equal_to<Value>.
324e4b17023SJohn Marino    *  @param  Alloc  Allocator type, defaults to allocator<Key>.
325e4b17023SJohn Marino    *
326e4b17023SJohn Marino    * The resulting value type of the container is std::pair<const Key, Tp>.
327e4b17023SJohn Marino    */
328e4b17023SJohn Marino   template<class _Key, class _Tp,
329e4b17023SJohn Marino 	   class _Hash = hash<_Key>,
330e4b17023SJohn Marino 	   class _Pred = std::equal_to<_Key>,
331e4b17023SJohn Marino 	   class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
332e4b17023SJohn Marino     class unordered_multimap
333e4b17023SJohn Marino     : public __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
334e4b17023SJohn Marino     {
335e4b17023SJohn Marino       typedef __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>  _Base;
336e4b17023SJohn Marino 
337e4b17023SJohn Marino     public:
338e4b17023SJohn Marino       typedef typename _Base::value_type      value_type;
339e4b17023SJohn Marino       typedef typename _Base::size_type       size_type;
340e4b17023SJohn Marino       typedef typename _Base::hasher          hasher;
341e4b17023SJohn Marino       typedef typename _Base::key_equal       key_equal;
342e4b17023SJohn Marino       typedef typename _Base::allocator_type  allocator_type;
343e4b17023SJohn Marino 
344e4b17023SJohn Marino       explicit
345e4b17023SJohn Marino       unordered_multimap(size_type __n = 10,
346e4b17023SJohn Marino 			 const hasher& __hf = hasher(),
347e4b17023SJohn Marino 			 const key_equal& __eql = key_equal(),
348e4b17023SJohn Marino 			 const allocator_type& __a = allocator_type())
349e4b17023SJohn Marino       : _Base(__n, __hf, __eql, __a)
350e4b17023SJohn Marino       { }
351e4b17023SJohn Marino 
352e4b17023SJohn Marino       template<typename _InputIterator>
353e4b17023SJohn Marino         unordered_multimap(_InputIterator __f, _InputIterator __l,
354e4b17023SJohn Marino 			   size_type __n = 0,
355e4b17023SJohn Marino 			   const hasher& __hf = hasher(),
356e4b17023SJohn Marino 			   const key_equal& __eql = key_equal(),
357e4b17023SJohn Marino 			   const allocator_type& __a = allocator_type())
358e4b17023SJohn Marino 	: _Base(__f, __l, __n, __hf, __eql, __a)
359e4b17023SJohn Marino         { }
360e4b17023SJohn Marino 
361e4b17023SJohn Marino       unordered_multimap(initializer_list<value_type> __l,
362e4b17023SJohn Marino 			 size_type __n = 0,
363e4b17023SJohn Marino 			 const hasher& __hf = hasher(),
364e4b17023SJohn Marino 			 const key_equal& __eql = key_equal(),
365e4b17023SJohn Marino 			 const allocator_type& __a = allocator_type())
366e4b17023SJohn Marino       : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
367e4b17023SJohn Marino       { }
368e4b17023SJohn Marino 
369e4b17023SJohn Marino       unordered_multimap&
370e4b17023SJohn Marino       operator=(initializer_list<value_type> __l)
371e4b17023SJohn Marino       {
372e4b17023SJohn Marino 	this->clear();
373e4b17023SJohn Marino 	this->insert(__l.begin(), __l.end());
374e4b17023SJohn Marino 	return *this;
375e4b17023SJohn Marino       }
376e4b17023SJohn Marino     };
377e4b17023SJohn Marino 
378e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
379e4b17023SJohn Marino     inline void
380e4b17023SJohn Marino     swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
381e4b17023SJohn Marino 	 unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
382e4b17023SJohn Marino     { __x.swap(__y); }
383e4b17023SJohn Marino 
384e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
385e4b17023SJohn Marino     inline void
386e4b17023SJohn Marino     swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
387e4b17023SJohn Marino 	 unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
388e4b17023SJohn Marino     { __x.swap(__y); }
389e4b17023SJohn Marino 
390e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
391e4b17023SJohn Marino     inline bool
392e4b17023SJohn Marino     operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
393e4b17023SJohn Marino 	       const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
394e4b17023SJohn Marino     { return __x._M_equal(__y); }
395e4b17023SJohn Marino 
396e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
397e4b17023SJohn Marino     inline bool
398e4b17023SJohn Marino     operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
399e4b17023SJohn Marino 	       const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
400e4b17023SJohn Marino     { return !(__x == __y); }
401e4b17023SJohn Marino 
402e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
403e4b17023SJohn Marino     inline bool
404e4b17023SJohn Marino     operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
405e4b17023SJohn Marino 	       const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
406e4b17023SJohn Marino     { return __x._M_equal(__y); }
407e4b17023SJohn Marino 
408e4b17023SJohn Marino   template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
409e4b17023SJohn Marino     inline bool
410e4b17023SJohn Marino     operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
411e4b17023SJohn Marino 	       const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
412e4b17023SJohn Marino     { return !(__x == __y); }
413e4b17023SJohn Marino 
414e4b17023SJohn Marino _GLIBCXX_END_NAMESPACE_CONTAINER
415e4b17023SJohn Marino } // namespace std
416e4b17023SJohn Marino 
417e4b17023SJohn Marino #endif /* _UNORDERED_MAP_H */
418