xref: /dflybsd-src/contrib/gcc-4.7/libstdc++-v3/include/bits/unordered_set.h (revision 81fc95a5293ee307c688a350a3feb4734aaddbb4)
1e4b17023SJohn Marino // unordered_set 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_set.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_set}
28e4b17023SJohn Marino  */
29e4b17023SJohn Marino 
30e4b17023SJohn Marino #ifndef _UNORDERED_SET_H
31e4b17023SJohn Marino #define _UNORDERED_SET_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 _Value,
40e4b17023SJohn Marino 	   class _Hash = hash<_Value>,
41e4b17023SJohn Marino 	   class _Pred = std::equal_to<_Value>,
42e4b17023SJohn Marino 	   class _Alloc = std::allocator<_Value>,
43e4b17023SJohn Marino 	   bool __cache_hash_code =
44e4b17023SJohn Marino 	     __not_<__and_<is_integral<_Value>, is_empty<_Hash>,
45e4b17023SJohn Marino 			   integral_constant<bool, !__is_final(_Hash)>,
46e4b17023SJohn Marino 			   __detail::__is_noexcept_hash<_Value, _Hash>>>::value>
47e4b17023SJohn Marino     class __unordered_set
48e4b17023SJohn Marino     : public _Hashtable<_Value, _Value, _Alloc,
49e4b17023SJohn Marino 			std::_Identity<_Value>, _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, true, true>,
54*5ce9237cSJohn Marino       __check_copy_constructible<_Alloc>
55e4b17023SJohn Marino     {
56e4b17023SJohn Marino       typedef _Hashtable<_Value, _Value, _Alloc,
57e4b17023SJohn Marino 			 std::_Identity<_Value>, _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, true, 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       typedef typename _Base::iterator        iterator;
71e4b17023SJohn Marino       typedef typename _Base::const_iterator  const_iterator;
72e4b17023SJohn Marino 
73e4b17023SJohn Marino       explicit
74e4b17023SJohn Marino       __unordered_set(size_type __n = 10,
75e4b17023SJohn Marino 		      const hasher& __hf = hasher(),
76e4b17023SJohn Marino 		      const key_equal& __eql = key_equal(),
77e4b17023SJohn Marino 		      const allocator_type& __a = allocator_type())
78e4b17023SJohn Marino       : _Base(__n, __hf, __detail::_Mod_range_hashing(),
79e4b17023SJohn Marino 	      __detail::_Default_ranged_hash(), __eql,
80e4b17023SJohn Marino 	      std::_Identity<value_type>(), __a)
81e4b17023SJohn Marino       { }
82e4b17023SJohn Marino 
83e4b17023SJohn Marino       template<typename _InputIterator>
84e4b17023SJohn Marino         __unordered_set(_InputIterator __f, _InputIterator __l,
85e4b17023SJohn Marino 			size_type __n = 0,
86e4b17023SJohn Marino 			const hasher& __hf = hasher(),
87e4b17023SJohn Marino 			const key_equal& __eql = key_equal(),
88e4b17023SJohn Marino 			const allocator_type& __a = allocator_type())
89e4b17023SJohn Marino 	: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
90e4b17023SJohn Marino 		__detail::_Default_ranged_hash(), __eql,
91e4b17023SJohn Marino 		std::_Identity<value_type>(), __a)
92e4b17023SJohn Marino         { }
93e4b17023SJohn Marino 
94e4b17023SJohn Marino       __unordered_set(initializer_list<value_type> __l,
95e4b17023SJohn Marino 		      size_type __n = 0,
96e4b17023SJohn Marino 		      const hasher& __hf = hasher(),
97e4b17023SJohn Marino 		      const key_equal& __eql = key_equal(),
98e4b17023SJohn Marino 		      const allocator_type& __a = allocator_type())
99e4b17023SJohn Marino       : _Base(__l.begin(), __l.end(), __n, __hf,
100e4b17023SJohn Marino 	      __detail::_Mod_range_hashing(),
101e4b17023SJohn Marino 	      __detail::_Default_ranged_hash(), __eql,
102e4b17023SJohn Marino 	      std::_Identity<value_type>(), __a)
103e4b17023SJohn Marino       { }
104e4b17023SJohn Marino 
105e4b17023SJohn Marino       __unordered_set&
106e4b17023SJohn Marino       operator=(initializer_list<value_type> __l)
107e4b17023SJohn Marino       {
108e4b17023SJohn Marino 	this->clear();
109e4b17023SJohn Marino 	this->insert(__l.begin(), __l.end());
110e4b17023SJohn Marino 	return *this;
111e4b17023SJohn Marino       }
112e4b17023SJohn Marino 
113e4b17023SJohn Marino       using _Base::insert;
114e4b17023SJohn Marino 
115e4b17023SJohn Marino       std::pair<iterator, bool>
116e4b17023SJohn Marino       insert(value_type&& __v)
117e4b17023SJohn Marino       { return this->_M_insert(std::move(__v), std::true_type()); }
118e4b17023SJohn Marino 
119e4b17023SJohn Marino       iterator
120e4b17023SJohn Marino       insert(const_iterator, value_type&& __v)
121e4b17023SJohn Marino       { return insert(std::move(__v)).first; }
122e4b17023SJohn Marino     };
123e4b17023SJohn Marino 
124e4b17023SJohn Marino   template<class _Value,
125e4b17023SJohn Marino 	   class _Hash = hash<_Value>,
126e4b17023SJohn Marino 	   class _Pred = std::equal_to<_Value>,
127e4b17023SJohn Marino 	   class _Alloc = std::allocator<_Value>,
128e4b17023SJohn Marino 	   bool __cache_hash_code =
129e4b17023SJohn Marino 	     __not_<__and_<is_integral<_Value>, is_empty<_Hash>,
130e4b17023SJohn Marino 			   integral_constant<bool, !__is_final(_Hash)>,
131e4b17023SJohn Marino 			   __detail::__is_noexcept_hash<_Value, _Hash>>>::value>
132e4b17023SJohn Marino     class __unordered_multiset
133e4b17023SJohn Marino     : public _Hashtable<_Value, _Value, _Alloc,
134e4b17023SJohn Marino 			std::_Identity<_Value>, _Pred,
135e4b17023SJohn Marino 			_Hash, __detail::_Mod_range_hashing,
136e4b17023SJohn Marino 			__detail::_Default_ranged_hash,
137e4b17023SJohn Marino 			__detail::_Prime_rehash_policy,
138*5ce9237cSJohn Marino 			__cache_hash_code, true, false>,
139*5ce9237cSJohn Marino       __check_copy_constructible<_Alloc>
140e4b17023SJohn Marino     {
141e4b17023SJohn Marino       typedef _Hashtable<_Value, _Value, _Alloc,
142e4b17023SJohn Marino 			 std::_Identity<_Value>, _Pred,
143e4b17023SJohn Marino 			 _Hash, __detail::_Mod_range_hashing,
144e4b17023SJohn Marino 			 __detail::_Default_ranged_hash,
145e4b17023SJohn Marino 			 __detail::_Prime_rehash_policy,
146e4b17023SJohn Marino 			 __cache_hash_code, true, false>
147e4b17023SJohn Marino         _Base;
148e4b17023SJohn Marino 
149e4b17023SJohn Marino     public:
150e4b17023SJohn Marino       typedef typename _Base::value_type      value_type;
151e4b17023SJohn Marino       typedef typename _Base::size_type       size_type;
152e4b17023SJohn Marino       typedef typename _Base::hasher          hasher;
153e4b17023SJohn Marino       typedef typename _Base::key_equal       key_equal;
154e4b17023SJohn Marino       typedef typename _Base::allocator_type  allocator_type;
155e4b17023SJohn Marino       typedef typename _Base::iterator        iterator;
156e4b17023SJohn Marino       typedef typename _Base::const_iterator  const_iterator;
157e4b17023SJohn Marino 
158e4b17023SJohn Marino       explicit
159e4b17023SJohn Marino       __unordered_multiset(size_type __n = 10,
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(__n, __hf, __detail::_Mod_range_hashing(),
164e4b17023SJohn Marino 	      __detail::_Default_ranged_hash(), __eql,
165e4b17023SJohn Marino 	      std::_Identity<value_type>(), __a)
166e4b17023SJohn Marino       { }
167e4b17023SJohn Marino 
168e4b17023SJohn Marino 
169e4b17023SJohn Marino       template<typename _InputIterator>
170e4b17023SJohn Marino         __unordered_multiset(_InputIterator __f, _InputIterator __l,
171e4b17023SJohn Marino 			     size_type __n = 0,
172e4b17023SJohn Marino 			     const hasher& __hf = hasher(),
173e4b17023SJohn Marino 			     const key_equal& __eql = key_equal(),
174e4b17023SJohn Marino 			     const allocator_type& __a = allocator_type())
175e4b17023SJohn Marino 	: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
176e4b17023SJohn Marino 		__detail::_Default_ranged_hash(), __eql,
177e4b17023SJohn Marino 		std::_Identity<value_type>(), __a)
178e4b17023SJohn Marino         { }
179e4b17023SJohn Marino 
180e4b17023SJohn Marino       __unordered_multiset(initializer_list<value_type> __l,
181e4b17023SJohn Marino 			   size_type __n = 0,
182e4b17023SJohn Marino 			   const hasher& __hf = hasher(),
183e4b17023SJohn Marino 			   const key_equal& __eql = key_equal(),
184e4b17023SJohn Marino 			   const allocator_type& __a = allocator_type())
185e4b17023SJohn Marino       : _Base(__l.begin(), __l.end(), __n, __hf,
186e4b17023SJohn Marino 	      __detail::_Mod_range_hashing(),
187e4b17023SJohn Marino 	      __detail::_Default_ranged_hash(), __eql,
188e4b17023SJohn Marino 	      std::_Identity<value_type>(), __a)
189e4b17023SJohn Marino       { }
190e4b17023SJohn Marino 
191e4b17023SJohn Marino       __unordered_multiset&
192e4b17023SJohn Marino       operator=(initializer_list<value_type> __l)
193e4b17023SJohn Marino       {
194e4b17023SJohn Marino 	this->clear();
195e4b17023SJohn Marino 	this->insert(__l.begin(), __l.end());
196e4b17023SJohn Marino 	return *this;
197e4b17023SJohn Marino       }
198e4b17023SJohn Marino 
199e4b17023SJohn Marino       using _Base::insert;
200e4b17023SJohn Marino 
201e4b17023SJohn Marino       iterator
202e4b17023SJohn Marino       insert(value_type&& __v)
203e4b17023SJohn Marino       { return this->_M_insert(std::move(__v), std::false_type()); }
204e4b17023SJohn Marino 
205e4b17023SJohn Marino       iterator
206e4b17023SJohn Marino       insert(const_iterator, value_type&& __v)
207e4b17023SJohn Marino       { return insert(std::move(__v)); }
208e4b17023SJohn Marino     };
209e4b17023SJohn Marino 
210e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc,
211e4b17023SJohn Marino 	   bool __cache_hash_code>
212e4b17023SJohn Marino     inline void
213e4b17023SJohn Marino     swap(__unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __x,
214e4b17023SJohn Marino 	 __unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __y)
215e4b17023SJohn Marino     { __x.swap(__y); }
216e4b17023SJohn Marino 
217e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc,
218e4b17023SJohn Marino 	   bool __cache_hash_code>
219e4b17023SJohn Marino     inline void
220e4b17023SJohn Marino     swap(__unordered_multiset<_Value, _Hash, _Pred,
221e4b17023SJohn Marino 	 _Alloc, __cache_hash_code>& __x,
222e4b17023SJohn Marino 	 __unordered_multiset<_Value, _Hash, _Pred,
223e4b17023SJohn Marino 	 _Alloc, __cache_hash_code>& __y)
224e4b17023SJohn Marino     { __x.swap(__y); }
225e4b17023SJohn Marino 
226e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc,
227e4b17023SJohn Marino 	   bool __cache_hash_code>
228e4b17023SJohn Marino     inline bool
229e4b17023SJohn Marino     operator==(const __unordered_set<_Value, _Hash, _Pred, _Alloc,
230e4b17023SJohn Marino 	       __cache_hash_code>& __x,
231e4b17023SJohn Marino 	       const __unordered_set<_Value, _Hash, _Pred, _Alloc,
232e4b17023SJohn Marino 	       __cache_hash_code>& __y)
233e4b17023SJohn Marino     { return __x._M_equal(__y); }
234e4b17023SJohn Marino 
235e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc,
236e4b17023SJohn Marino 	   bool __cache_hash_code>
237e4b17023SJohn Marino     inline bool
238e4b17023SJohn Marino     operator!=(const __unordered_set<_Value, _Hash, _Pred, _Alloc,
239e4b17023SJohn Marino 	       __cache_hash_code>& __x,
240e4b17023SJohn Marino 	       const __unordered_set<_Value, _Hash, _Pred, _Alloc,
241e4b17023SJohn Marino 	       __cache_hash_code>& __y)
242e4b17023SJohn Marino     { return !(__x == __y); }
243e4b17023SJohn Marino 
244e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc,
245e4b17023SJohn Marino 	   bool __cache_hash_code>
246e4b17023SJohn Marino     inline bool
247e4b17023SJohn Marino     operator==(const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
248e4b17023SJohn Marino 	       __cache_hash_code>& __x,
249e4b17023SJohn Marino 	       const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
250e4b17023SJohn Marino 	       __cache_hash_code>& __y)
251e4b17023SJohn Marino     { return __x._M_equal(__y); }
252e4b17023SJohn Marino 
253e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc,
254e4b17023SJohn Marino 	   bool __cache_hash_code>
255e4b17023SJohn Marino     inline bool
256e4b17023SJohn Marino     operator!=(const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
257e4b17023SJohn Marino 	       __cache_hash_code>& __x,
258e4b17023SJohn Marino 	       const __unordered_multiset<_Value, _Hash, _Pred, _Alloc,
259e4b17023SJohn Marino 	       __cache_hash_code>& __y)
260e4b17023SJohn Marino     { return !(__x == __y); }
261e4b17023SJohn Marino 
262e4b17023SJohn Marino   /**
263e4b17023SJohn Marino    *  @brief A standard container composed of unique keys (containing
264e4b17023SJohn Marino    *  at most one of each key value) in which the elements' keys are
265e4b17023SJohn Marino    *  the elements themselves.
266e4b17023SJohn Marino    *
267e4b17023SJohn Marino    *  @ingroup unordered_associative_containers
268e4b17023SJohn Marino    *
269e4b17023SJohn Marino    *  Meets the requirements of a <a href="tables.html#65">container</a>, and
270e4b17023SJohn Marino    *  <a href="tables.html#xx">unordered associative container</a>
271e4b17023SJohn Marino    *
272e4b17023SJohn Marino    *  @param  Value  Type of key objects.
273e4b17023SJohn Marino    *  @param  Hash  Hashing function object type, defaults to hash<Value>.
274e4b17023SJohn Marino    *  @param  Pred  Predicate function object type, defaults to equal_to<Value>.
275e4b17023SJohn Marino    *  @param  Alloc  Allocator type, defaults to allocator<Key>.
276e4b17023SJohn Marino    */
277e4b17023SJohn Marino   template<class _Value,
278e4b17023SJohn Marino 	   class _Hash = hash<_Value>,
279e4b17023SJohn Marino 	   class _Pred = std::equal_to<_Value>,
280e4b17023SJohn Marino 	   class _Alloc = std::allocator<_Value> >
281e4b17023SJohn Marino     class unordered_set
282e4b17023SJohn Marino     : public __unordered_set<_Value, _Hash, _Pred, _Alloc>
283e4b17023SJohn Marino     {
284e4b17023SJohn Marino       typedef __unordered_set<_Value, _Hash, _Pred, _Alloc>  _Base;
285e4b17023SJohn Marino 
286e4b17023SJohn Marino     public:
287e4b17023SJohn Marino       typedef typename _Base::value_type      value_type;
288e4b17023SJohn Marino       typedef typename _Base::size_type       size_type;
289e4b17023SJohn Marino       typedef typename _Base::hasher          hasher;
290e4b17023SJohn Marino       typedef typename _Base::key_equal       key_equal;
291e4b17023SJohn Marino       typedef typename _Base::allocator_type  allocator_type;
292e4b17023SJohn Marino 
293e4b17023SJohn Marino       explicit
294e4b17023SJohn Marino       unordered_set(size_type __n = 10,
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(__n, __hf, __eql, __a)
299e4b17023SJohn Marino       { }
300e4b17023SJohn Marino 
301e4b17023SJohn Marino       template<typename _InputIterator>
302e4b17023SJohn Marino         unordered_set(_InputIterator __f, _InputIterator __l,
303e4b17023SJohn Marino 		      size_type __n = 0,
304e4b17023SJohn Marino 		      const hasher& __hf = hasher(),
305e4b17023SJohn Marino 		      const key_equal& __eql = key_equal(),
306e4b17023SJohn Marino 		      const allocator_type& __a = allocator_type())
307e4b17023SJohn Marino 	: _Base(__f, __l, __n, __hf, __eql, __a)
308e4b17023SJohn Marino         { }
309e4b17023SJohn Marino 
310e4b17023SJohn Marino       unordered_set(initializer_list<value_type> __l,
311e4b17023SJohn Marino 		    size_type __n = 0,
312e4b17023SJohn Marino 		    const hasher& __hf = hasher(),
313e4b17023SJohn Marino 		    const key_equal& __eql = key_equal(),
314e4b17023SJohn Marino 		    const allocator_type& __a = allocator_type())
315e4b17023SJohn Marino       : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
316e4b17023SJohn Marino       { }
317e4b17023SJohn Marino 
318e4b17023SJohn Marino       unordered_set&
319e4b17023SJohn Marino       operator=(initializer_list<value_type> __l)
320e4b17023SJohn Marino       {
321e4b17023SJohn Marino 	this->clear();
322e4b17023SJohn Marino 	this->insert(__l.begin(), __l.end());
323e4b17023SJohn Marino 	return *this;
324e4b17023SJohn Marino       }
325e4b17023SJohn Marino     };
326e4b17023SJohn Marino 
327e4b17023SJohn Marino   /**
328e4b17023SJohn Marino    *  @brief A standard container composed of equivalent keys
329e4b17023SJohn Marino    *  (possibly containing multiple of each key value) in which the
330e4b17023SJohn Marino    *  elements' keys are the elements themselves.
331e4b17023SJohn Marino    *
332e4b17023SJohn Marino    *  @ingroup unordered_associative_containers
333e4b17023SJohn Marino    *
334e4b17023SJohn Marino    *  Meets the requirements of a <a href="tables.html#65">container</a>, and
335e4b17023SJohn Marino    *  <a href="tables.html#xx">unordered associative container</a>
336e4b17023SJohn Marino    *
337e4b17023SJohn Marino    *  @param  Value  Type of key objects.
338e4b17023SJohn Marino    *  @param  Hash  Hashing function object type, defaults to hash<Value>.
339e4b17023SJohn Marino    *  @param  Pred  Predicate function object type, defaults to equal_to<Value>.
340e4b17023SJohn Marino    *  @param  Alloc  Allocator type, defaults to allocator<Key>.
341e4b17023SJohn Marino    */
342e4b17023SJohn Marino   template<class _Value,
343e4b17023SJohn Marino 	   class _Hash = hash<_Value>,
344e4b17023SJohn Marino 	   class _Pred = std::equal_to<_Value>,
345e4b17023SJohn Marino 	   class _Alloc = std::allocator<_Value> >
346e4b17023SJohn Marino     class unordered_multiset
347e4b17023SJohn Marino     : public __unordered_multiset<_Value, _Hash, _Pred, _Alloc>
348e4b17023SJohn Marino     {
349e4b17023SJohn Marino       typedef __unordered_multiset<_Value, _Hash, _Pred, _Alloc>  _Base;
350e4b17023SJohn Marino 
351e4b17023SJohn Marino     public:
352e4b17023SJohn Marino       typedef typename _Base::value_type      value_type;
353e4b17023SJohn Marino       typedef typename _Base::size_type       size_type;
354e4b17023SJohn Marino       typedef typename _Base::hasher          hasher;
355e4b17023SJohn Marino       typedef typename _Base::key_equal       key_equal;
356e4b17023SJohn Marino       typedef typename _Base::allocator_type  allocator_type;
357e4b17023SJohn Marino 
358e4b17023SJohn Marino       explicit
359e4b17023SJohn Marino       unordered_multiset(size_type __n = 10,
360e4b17023SJohn Marino 			 const hasher& __hf = hasher(),
361e4b17023SJohn Marino 			 const key_equal& __eql = key_equal(),
362e4b17023SJohn Marino 			 const allocator_type& __a = allocator_type())
363e4b17023SJohn Marino       : _Base(__n, __hf, __eql, __a)
364e4b17023SJohn Marino       { }
365e4b17023SJohn Marino 
366e4b17023SJohn Marino 
367e4b17023SJohn Marino       template<typename _InputIterator>
368e4b17023SJohn Marino         unordered_multiset(_InputIterator __f, _InputIterator __l,
369e4b17023SJohn Marino 			   size_type __n = 0,
370e4b17023SJohn Marino 			   const hasher& __hf = hasher(),
371e4b17023SJohn Marino 			   const key_equal& __eql = key_equal(),
372e4b17023SJohn Marino 			   const allocator_type& __a = allocator_type())
373e4b17023SJohn Marino 	: _Base(__f, __l, __n, __hf, __eql, __a)
374e4b17023SJohn Marino         { }
375e4b17023SJohn Marino 
376e4b17023SJohn Marino       unordered_multiset(initializer_list<value_type> __l,
377e4b17023SJohn Marino 			 size_type __n = 0,
378e4b17023SJohn Marino 			 const hasher& __hf = hasher(),
379e4b17023SJohn Marino 			 const key_equal& __eql = key_equal(),
380e4b17023SJohn Marino 			 const allocator_type& __a = allocator_type())
381e4b17023SJohn Marino       : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
382e4b17023SJohn Marino       { }
383e4b17023SJohn Marino 
384e4b17023SJohn Marino       unordered_multiset&
385e4b17023SJohn Marino       operator=(initializer_list<value_type> __l)
386e4b17023SJohn Marino       {
387e4b17023SJohn Marino 	this->clear();
388e4b17023SJohn Marino 	this->insert(__l.begin(), __l.end());
389e4b17023SJohn Marino 	return *this;
390e4b17023SJohn Marino       }
391e4b17023SJohn Marino     };
392e4b17023SJohn Marino 
393e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc>
394e4b17023SJohn Marino     inline void
395e4b17023SJohn Marino     swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
396e4b17023SJohn Marino 	 unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
397e4b17023SJohn Marino     { __x.swap(__y); }
398e4b17023SJohn Marino 
399e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc>
400e4b17023SJohn Marino     inline void
401e4b17023SJohn Marino     swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
402e4b17023SJohn Marino 	 unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
403e4b17023SJohn Marino     { __x.swap(__y); }
404e4b17023SJohn Marino 
405e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc>
406e4b17023SJohn Marino     inline bool
407e4b17023SJohn Marino     operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
408e4b17023SJohn Marino 	       const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
409e4b17023SJohn Marino     { return __x._M_equal(__y); }
410e4b17023SJohn Marino 
411e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc>
412e4b17023SJohn Marino     inline bool
413e4b17023SJohn Marino     operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
414e4b17023SJohn Marino 	       const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
415e4b17023SJohn Marino     { return !(__x == __y); }
416e4b17023SJohn Marino 
417e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc>
418e4b17023SJohn Marino     inline bool
419e4b17023SJohn Marino     operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
420e4b17023SJohn Marino 	       const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
421e4b17023SJohn Marino     { return __x._M_equal(__y); }
422e4b17023SJohn Marino 
423e4b17023SJohn Marino   template<class _Value, class _Hash, class _Pred, class _Alloc>
424e4b17023SJohn Marino     inline bool
425e4b17023SJohn Marino     operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
426e4b17023SJohn Marino 	       const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
427e4b17023SJohn Marino     { return !(__x == __y); }
428e4b17023SJohn Marino 
429e4b17023SJohn Marino _GLIBCXX_END_NAMESPACE_CONTAINER
430e4b17023SJohn Marino } // namespace std
431e4b17023SJohn Marino 
432e4b17023SJohn Marino #endif /* _UNORDERED_SET_H */
433e4b17023SJohn Marino 
434