blob: 2ef54334804e4332dc0ce70230b8b65ad1a5e20f [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001// -*- C++ -*-
2//===-------------------------- unordered_set -----------------------------===//
3//
Howard Hinnantf5256e12010-05-11 21:36:01 +00004// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00005//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00006// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00008//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_UNORDERED_SET
12#define _LIBCPP_UNORDERED_SET
13
14/*
15
16 unordered_set synopsis
17
18#include <initializer_list>
19
20namespace std
21{
22
23template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
24 class Alloc = allocator<Value>>
25class unordered_set
26{
27public:
28 // types
29 typedef Value key_type;
30 typedef key_type value_type;
31 typedef Hash hasher;
32 typedef Pred key_equal;
33 typedef Alloc allocator_type;
34 typedef value_type& reference;
35 typedef const value_type& const_reference;
36 typedef typename allocator_traits<allocator_type>::pointer pointer;
37 typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
38 typedef typename allocator_traits<allocator_type>::size_type size_type;
39 typedef typename allocator_traits<allocator_type>::difference_type difference_type;
40
41 typedef /unspecified/ iterator;
42 typedef /unspecified/ const_iterator;
43 typedef /unspecified/ local_iterator;
44 typedef /unspecified/ const_local_iterator;
45
Howard Hinnant04dae1d2011-06-04 20:18:37 +000046 unordered_set()
47 noexcept(
48 is_nothrow_default_constructible<hasher>::value &&
49 is_nothrow_default_constructible<key_equal>::value &&
50 is_nothrow_default_constructible<allocator_type>::value);
51 explicit unordered_set(size_type n, const hasher& hf = hasher(),
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000052 const key_equal& eql = key_equal(),
53 const allocator_type& a = allocator_type());
54 template <class InputIterator>
55 unordered_set(InputIterator f, InputIterator l,
56 size_type n = 0, const hasher& hf = hasher(),
57 const key_equal& eql = key_equal(),
58 const allocator_type& a = allocator_type());
59 explicit unordered_set(const allocator_type&);
60 unordered_set(const unordered_set&);
61 unordered_set(const unordered_set&, const Allocator&);
Howard Hinnant04dae1d2011-06-04 20:18:37 +000062 unordered_set(unordered_set&&)
63 noexcept(
64 is_nothrow_move_constructible<hasher>::value &&
65 is_nothrow_move_constructible<key_equal>::value &&
66 is_nothrow_move_constructible<allocator_type>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000067 unordered_set(unordered_set&&, const Allocator&);
68 unordered_set(initializer_list<value_type>, size_type n = 0,
69 const hasher& hf = hasher(), const key_equal& eql = key_equal(),
70 const allocator_type& a = allocator_type());
71 ~unordered_set();
72 unordered_set& operator=(const unordered_set&);
Howard Hinnant04dae1d2011-06-04 20:18:37 +000073 unordered_set& operator=(unordered_set&&)
74 noexcept(
75 allocator_type::propagate_on_container_move_assignment::value &&
76 is_nothrow_move_assignable<allocator_type>::value &&
77 is_nothrow_move_assignable<hasher>::value &&
78 is_nothrow_move_assignable<key_equal>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000079 unordered_set& operator=(initializer_list<value_type>);
80
Howard Hinnant04dae1d2011-06-04 20:18:37 +000081 allocator_type get_allocator() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000082
Howard Hinnant04dae1d2011-06-04 20:18:37 +000083 bool empty() const noexcept;
84 size_type size() const noexcept;
85 size_type max_size() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000086
Howard Hinnant04dae1d2011-06-04 20:18:37 +000087 iterator begin() noexcept;
88 iterator end() noexcept;
89 const_iterator begin() const noexcept;
90 const_iterator end() const noexcept;
91 const_iterator cbegin() const noexcept;
92 const_iterator cend() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000093
94 template <class... Args>
95 pair<iterator, bool> emplace(Args&&... args);
96 template <class... Args>
97 iterator emplace_hint(const_iterator position, Args&&... args);
98 pair<iterator, bool> insert(const value_type& obj);
99 pair<iterator, bool> insert(value_type&& obj);
100 iterator insert(const_iterator hint, const value_type& obj);
101 iterator insert(const_iterator hint, value_type&& obj);
102 template <class InputIterator>
103 void insert(InputIterator first, InputIterator last);
104 void insert(initializer_list<value_type>);
105
106 iterator erase(const_iterator position);
107 size_type erase(const key_type& k);
108 iterator erase(const_iterator first, const_iterator last);
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000109 void clear() noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000110
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000111 void swap(unordered_set&)
112 noexcept(
113 (!allocator_type::propagate_on_container_swap::value ||
114 __is_nothrow_swappable<allocator_type>::value) &&
115 __is_nothrow_swappable<hasher>::value &&
116 __is_nothrow_swappable<key_equal>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000117
118 hasher hash_function() const;
119 key_equal key_eq() const;
120
121 iterator find(const key_type& k);
122 const_iterator find(const key_type& k) const;
123 size_type count(const key_type& k) const;
124 pair<iterator, iterator> equal_range(const key_type& k);
125 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
126
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000127 size_type bucket_count() const noexcept;
128 size_type max_bucket_count() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000129
130 size_type bucket_size(size_type n) const;
131 size_type bucket(const key_type& k) const;
132
133 local_iterator begin(size_type n);
134 local_iterator end(size_type n);
135 const_local_iterator begin(size_type n) const;
136 const_local_iterator end(size_type n) const;
137 const_local_iterator cbegin(size_type n) const;
138 const_local_iterator cend(size_type n) const;
139
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000140 float load_factor() const noexcept;
141 float max_load_factor() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000142 void max_load_factor(float z);
143 void rehash(size_type n);
144 void reserve(size_type n);
145};
146
147template <class Value, class Hash, class Pred, class Alloc>
148 void swap(unordered_set<Value, Hash, Pred, Alloc>& x,
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000149 unordered_set<Value, Hash, Pred, Alloc>& y)
150 noexcept(noexcept(x.swap(y)));
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000151
152template <class Value, class Hash, class Pred, class Alloc>
153 bool
154 operator==(const unordered_set<Value, Hash, Pred, Alloc>& x,
155 const unordered_set<Value, Hash, Pred, Alloc>& y);
156
157template <class Value, class Hash, class Pred, class Alloc>
158 bool
159 operator!=(const unordered_set<Value, Hash, Pred, Alloc>& x,
160 const unordered_set<Value, Hash, Pred, Alloc>& y);
161
162template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
163 class Alloc = allocator<Value>>
164class unordered_multiset
165{
166public:
167 // types
168 typedef Value key_type;
169 typedef key_type value_type;
170 typedef Hash hasher;
171 typedef Pred key_equal;
172 typedef Alloc allocator_type;
173 typedef value_type& reference;
174 typedef const value_type& const_reference;
175 typedef typename allocator_traits<allocator_type>::pointer pointer;
176 typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
177 typedef typename allocator_traits<allocator_type>::size_type size_type;
178 typedef typename allocator_traits<allocator_type>::difference_type difference_type;
179
180 typedef /unspecified/ iterator;
181 typedef /unspecified/ const_iterator;
182 typedef /unspecified/ local_iterator;
183 typedef /unspecified/ const_local_iterator;
184
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000185 unordered_multiset()
186 noexcept(
187 is_nothrow_default_constructible<hasher>::value &&
188 is_nothrow_default_constructible<key_equal>::value &&
189 is_nothrow_default_constructible<allocator_type>::value);
190 explicit unordered_multiset(size_type n, const hasher& hf = hasher(),
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000191 const key_equal& eql = key_equal(),
192 const allocator_type& a = allocator_type());
193 template <class InputIterator>
194 unordered_multiset(InputIterator f, InputIterator l,
195 size_type n = 0, const hasher& hf = hasher(),
196 const key_equal& eql = key_equal(),
197 const allocator_type& a = allocator_type());
198 explicit unordered_multiset(const allocator_type&);
199 unordered_multiset(const unordered_multiset&);
200 unordered_multiset(const unordered_multiset&, const Allocator&);
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000201 unordered_multiset(unordered_multiset&&)
202 noexcept(
203 is_nothrow_move_constructible<hasher>::value &&
204 is_nothrow_move_constructible<key_equal>::value &&
205 is_nothrow_move_constructible<allocator_type>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000206 unordered_multiset(unordered_multiset&&, const Allocator&);
207 unordered_multiset(initializer_list<value_type>, size_type n = /see below/,
208 const hasher& hf = hasher(), const key_equal& eql = key_equal(),
209 const allocator_type& a = allocator_type());
210 ~unordered_multiset();
211 unordered_multiset& operator=(const unordered_multiset&);
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000212 unordered_multiset& operator=(unordered_multiset&&)
213 noexcept(
214 allocator_type::propagate_on_container_move_assignment::value &&
215 is_nothrow_move_assignable<allocator_type>::value &&
216 is_nothrow_move_assignable<hasher>::value &&
217 is_nothrow_move_assignable<key_equal>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000218 unordered_multiset& operator=(initializer_list<value_type>);
219
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000220 allocator_type get_allocator() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000221
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000222 bool empty() const noexcept;
223 size_type size() const noexcept;
224 size_type max_size() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000225
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000226 iterator begin() noexcept;
227 iterator end() noexcept;
228 const_iterator begin() const noexcept;
229 const_iterator end() const noexcept;
230 const_iterator cbegin() const noexcept;
231 const_iterator cend() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000232
233 template <class... Args>
234 iterator emplace(Args&&... args);
235 template <class... Args>
236 iterator emplace_hint(const_iterator position, Args&&... args);
237 iterator insert(const value_type& obj);
238 iterator insert(value_type&& obj);
239 iterator insert(const_iterator hint, const value_type& obj);
240 iterator insert(const_iterator hint, value_type&& obj);
241 template <class InputIterator>
242 void insert(InputIterator first, InputIterator last);
243 void insert(initializer_list<value_type>);
244
245 iterator erase(const_iterator position);
246 size_type erase(const key_type& k);
247 iterator erase(const_iterator first, const_iterator last);
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000248 void clear() noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000249
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000250 void swap(unordered_multiset&)
251 noexcept(
252 (!allocator_type::propagate_on_container_swap::value ||
253 __is_nothrow_swappable<allocator_type>::value) &&
254 __is_nothrow_swappable<hasher>::value &&
255 __is_nothrow_swappable<key_equal>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000256
257 hasher hash_function() const;
258 key_equal key_eq() const;
259
260 iterator find(const key_type& k);
261 const_iterator find(const key_type& k) const;
262 size_type count(const key_type& k) const;
263 pair<iterator, iterator> equal_range(const key_type& k);
264 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
265
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000266 size_type bucket_count() const noexcept;
267 size_type max_bucket_count() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000268
269 size_type bucket_size(size_type n) const;
270 size_type bucket(const key_type& k) const;
271
272 local_iterator begin(size_type n);
273 local_iterator end(size_type n);
274 const_local_iterator begin(size_type n) const;
275 const_local_iterator end(size_type n) const;
276 const_local_iterator cbegin(size_type n) const;
277 const_local_iterator cend(size_type n) const;
278
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000279 float load_factor() const noexcept;
280 float max_load_factor() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000281 void max_load_factor(float z);
282 void rehash(size_type n);
283 void reserve(size_type n);
284};
285
286template <class Value, class Hash, class Pred, class Alloc>
287 void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x,
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000288 unordered_multiset<Value, Hash, Pred, Alloc>& y)
289 noexcept(noexcept(x.swap(y)));
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000290
291template <class Value, class Hash, class Pred, class Alloc>
292 bool
293 operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
294 const unordered_multiset<Value, Hash, Pred, Alloc>& y);
295
296template <class Value, class Hash, class Pred, class Alloc>
297 bool
298 operator!=(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
299 const unordered_multiset<Value, Hash, Pred, Alloc>& y);
300} // std
301
302*/
303
304#include <__config>
305#include <__hash_table>
306#include <functional>
307
308#pragma GCC system_header
309
310_LIBCPP_BEGIN_NAMESPACE_STD
311
312template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
313 class _Alloc = allocator<_Value> >
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000314class _LIBCPP_VISIBLE unordered_set
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000315{
316public:
317 // types
318 typedef _Value key_type;
319 typedef key_type value_type;
320 typedef _Hash hasher;
321 typedef _Pred key_equal;
322 typedef _Alloc allocator_type;
323 typedef value_type& reference;
324 typedef const value_type& const_reference;
325
326private:
327 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
328
329 __table __table_;
330
331public:
332 typedef typename __table::pointer pointer;
333 typedef typename __table::const_pointer const_pointer;
334 typedef typename __table::size_type size_type;
335 typedef typename __table::difference_type difference_type;
336
337 typedef typename __table::const_iterator iterator;
338 typedef typename __table::const_iterator const_iterator;
339 typedef typename __table::const_local_iterator local_iterator;
340 typedef typename __table::const_local_iterator const_local_iterator;
341
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000342 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000343 unordered_set()
344 _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
345 {} // = default;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000346 explicit unordered_set(size_type __n, const hasher& __hf = hasher(),
347 const key_equal& __eql = key_equal());
348 unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql,
349 const allocator_type& __a);
350 template <class _InputIterator>
351 unordered_set(_InputIterator __first, _InputIterator __last);
352 template <class _InputIterator>
353 unordered_set(_InputIterator __first, _InputIterator __last,
354 size_type __n, const hasher& __hf = hasher(),
355 const key_equal& __eql = key_equal());
356 template <class _InputIterator>
357 unordered_set(_InputIterator __first, _InputIterator __last,
358 size_type __n, const hasher& __hf, const key_equal& __eql,
359 const allocator_type& __a);
360 explicit unordered_set(const allocator_type& __a);
361 unordered_set(const unordered_set& __u);
362 unordered_set(const unordered_set& __u, const allocator_type& __a);
Howard Hinnant73d21a42010-09-04 23:28:19 +0000363#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000364 unordered_set(unordered_set&& __u)
365 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000366 unordered_set(unordered_set&& __u, const allocator_type& __a);
Howard Hinnant73d21a42010-09-04 23:28:19 +0000367#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000368 unordered_set(initializer_list<value_type> __il);
369 unordered_set(initializer_list<value_type> __il, size_type __n,
370 const hasher& __hf = hasher(),
371 const key_equal& __eql = key_equal());
372 unordered_set(initializer_list<value_type> __il, size_type __n,
373 const hasher& __hf, const key_equal& __eql,
374 const allocator_type& __a);
375 // ~unordered_set() = default;
Howard Hinnant61aa6012011-07-01 19:24:36 +0000376 _LIBCPP_INLINE_VISIBILITY
377 unordered_set& operator=(const unordered_set& __u)
378 {
379 __table_ = __u.__table_;
380 return *this;
381 }
Howard Hinnant73d21a42010-09-04 23:28:19 +0000382#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000383 unordered_set& operator=(unordered_set&& __u)
384 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000385#endif
386 unordered_set& operator=(initializer_list<value_type> __il);
387
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000388 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000389 allocator_type get_allocator() const _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000390 {return allocator_type(__table_.__node_alloc());}
391
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000392 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000393 bool empty() const _NOEXCEPT {return __table_.size() == 0;}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000394 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000395 size_type size() const _NOEXCEPT {return __table_.size();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000396 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000397 size_type max_size() const _NOEXCEPT {return __table_.max_size();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000398
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000399 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000400 iterator begin() _NOEXCEPT {return __table_.begin();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000401 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000402 iterator end() _NOEXCEPT {return __table_.end();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000403 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000404 const_iterator begin() const _NOEXCEPT {return __table_.begin();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000405 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000406 const_iterator end() const _NOEXCEPT {return __table_.end();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000407 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000408 const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000409 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000410 const_iterator cend() const _NOEXCEPT {return __table_.end();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000411
Howard Hinnant73d21a42010-09-04 23:28:19 +0000412#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000413 template <class... _Args>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000414 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000415 pair<iterator, bool> emplace(_Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000416 {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000417 template <class... _Args>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000418 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000419 iterator emplace_hint(const_iterator, _Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000420 {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;}
Howard Hinnant73d21a42010-09-04 23:28:19 +0000421#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000422 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000423 pair<iterator, bool> insert(const value_type& __x)
424 {return __table_.__insert_unique(__x);}
Howard Hinnant73d21a42010-09-04 23:28:19 +0000425#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000426 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000427 pair<iterator, bool> insert(value_type&& __x)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000428 {return __table_.__insert_unique(_VSTD::move(__x));}
Howard Hinnant73d21a42010-09-04 23:28:19 +0000429#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000430 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000431 iterator insert(const_iterator, const value_type& __x)
432 {return insert(__x).first;}
Howard Hinnant73d21a42010-09-04 23:28:19 +0000433#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000434 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000435 iterator insert(const_iterator, value_type&& __x)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000436 {return insert(_VSTD::move(__x)).first;}
Howard Hinnant73d21a42010-09-04 23:28:19 +0000437#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000438 template <class _InputIterator>
439 void insert(_InputIterator __first, _InputIterator __last);
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000440 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000441 void insert(initializer_list<value_type> __il)
442 {insert(__il.begin(), __il.end());}
443
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000444 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000445 iterator erase(const_iterator __p) {return __table_.erase(__p);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000446 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000447 size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000448 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000449 iterator erase(const_iterator __first, const_iterator __last)
450 {return __table_.erase(__first, __last);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000451 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000452 void clear() _NOEXCEPT {__table_.clear();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000453
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000454 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000455 void swap(unordered_set& __u)
456 _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
457 {__table_.swap(__u.__table_);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000458
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000459 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000460 hasher hash_function() const {return __table_.hash_function();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000461 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000462 key_equal key_eq() const {return __table_.key_eq();}
463
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000464 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000465 iterator find(const key_type& __k) {return __table_.find(__k);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000466 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000467 const_iterator find(const key_type& __k) const {return __table_.find(__k);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000468 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000469 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000470 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000471 pair<iterator, iterator> equal_range(const key_type& __k)
472 {return __table_.__equal_range_unique(__k);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000473 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000474 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
475 {return __table_.__equal_range_unique(__k);}
476
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000477 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000478 size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000479 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000480 size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000481
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000482 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000483 size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000484 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000485 size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
486
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000487 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000488 local_iterator begin(size_type __n) {return __table_.begin(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000489 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000490 local_iterator end(size_type __n) {return __table_.end(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000491 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000492 const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000493 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000494 const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000495 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000496 const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000497 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000498 const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
499
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000500 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000501 float load_factor() const _NOEXCEPT {return __table_.load_factor();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000502 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000503 float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000504 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000505 void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000506 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000507 void rehash(size_type __n) {__table_.rehash(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000508 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000509 void reserve(size_type __n) {__table_.reserve(__n);}
510};
511
512template <class _Value, class _Hash, class _Pred, class _Alloc>
513unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
514 const hasher& __hf, const key_equal& __eql)
515 : __table_(__hf, __eql)
516{
517 __table_.rehash(__n);
518}
519
520template <class _Value, class _Hash, class _Pred, class _Alloc>
521unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
522 const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
523 : __table_(__hf, __eql, __a)
524{
525 __table_.rehash(__n);
526}
527
528template <class _Value, class _Hash, class _Pred, class _Alloc>
529template <class _InputIterator>
530unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
531 _InputIterator __first, _InputIterator __last)
532{
533 insert(__first, __last);
534}
535
536template <class _Value, class _Hash, class _Pred, class _Alloc>
537template <class _InputIterator>
538unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
539 _InputIterator __first, _InputIterator __last, size_type __n,
540 const hasher& __hf, const key_equal& __eql)
541 : __table_(__hf, __eql)
542{
543 __table_.rehash(__n);
544 insert(__first, __last);
545}
546
547template <class _Value, class _Hash, class _Pred, class _Alloc>
548template <class _InputIterator>
549unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
550 _InputIterator __first, _InputIterator __last, size_type __n,
551 const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
552 : __table_(__hf, __eql, __a)
553{
554 __table_.rehash(__n);
555 insert(__first, __last);
556}
557
558template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000559inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000560unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
561 const allocator_type& __a)
562 : __table_(__a)
563{
564}
565
566template <class _Value, class _Hash, class _Pred, class _Alloc>
567unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
568 const unordered_set& __u)
569 : __table_(__u.__table_)
570{
571 __table_.rehash(__u.bucket_count());
572 insert(__u.begin(), __u.end());
573}
574
575template <class _Value, class _Hash, class _Pred, class _Alloc>
576unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
577 const unordered_set& __u, const allocator_type& __a)
578 : __table_(__u.__table_, __a)
579{
580 __table_.rehash(__u.bucket_count());
581 insert(__u.begin(), __u.end());
582}
583
Howard Hinnant73d21a42010-09-04 23:28:19 +0000584#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000585
586template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000587inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000588unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
589 unordered_set&& __u)
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000590 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000591 : __table_(_VSTD::move(__u.__table_))
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000592{
593}
594
595template <class _Value, class _Hash, class _Pred, class _Alloc>
596unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
597 unordered_set&& __u, const allocator_type& __a)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000598 : __table_(_VSTD::move(__u.__table_), __a)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000599{
600 if (__a != __u.get_allocator())
601 {
602 iterator __i = __u.begin();
603 while (__u.size() != 0)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000604 __table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_));
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000605 }
606}
607
Howard Hinnant73d21a42010-09-04 23:28:19 +0000608#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000609
610template <class _Value, class _Hash, class _Pred, class _Alloc>
611unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
612 initializer_list<value_type> __il)
613{
614 insert(__il.begin(), __il.end());
615}
616
617template <class _Value, class _Hash, class _Pred, class _Alloc>
618unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
619 initializer_list<value_type> __il, size_type __n, const hasher& __hf,
620 const key_equal& __eql)
621 : __table_(__hf, __eql)
622{
623 __table_.rehash(__n);
624 insert(__il.begin(), __il.end());
625}
626
627template <class _Value, class _Hash, class _Pred, class _Alloc>
628unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
629 initializer_list<value_type> __il, size_type __n, const hasher& __hf,
630 const key_equal& __eql, const allocator_type& __a)
631 : __table_(__hf, __eql, __a)
632{
633 __table_.rehash(__n);
634 insert(__il.begin(), __il.end());
635}
636
Howard Hinnant73d21a42010-09-04 23:28:19 +0000637#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000638
639template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000640inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000641unordered_set<_Value, _Hash, _Pred, _Alloc>&
642unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000643 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000644{
Howard Hinnant0949eed2011-06-30 21:18:19 +0000645 __table_ = _VSTD::move(__u.__table_);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000646 return *this;
647}
648
Howard Hinnant73d21a42010-09-04 23:28:19 +0000649#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000650
651template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000652inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000653unordered_set<_Value, _Hash, _Pred, _Alloc>&
654unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
655 initializer_list<value_type> __il)
656{
657 __table_.__assign_unique(__il.begin(), __il.end());
658 return *this;
659}
660
661template <class _Value, class _Hash, class _Pred, class _Alloc>
662template <class _InputIterator>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000663inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000664void
665unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
666 _InputIterator __last)
667{
668 for (; __first != __last; ++__first)
669 __table_.__insert_unique(*__first);
670}
671
672template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000673inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000674void
675swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
676 unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000677 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000678{
679 __x.swap(__y);
680}
681
682template <class _Value, class _Hash, class _Pred, class _Alloc>
683bool
684operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
685 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
686{
687 if (__x.size() != __y.size())
688 return false;
689 typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator
690 const_iterator;
691 for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();
692 __i != __ex; ++__i)
693 {
694 const_iterator __j = __y.find(*__i);
695 if (__j == __ey || !(*__i == *__j))
696 return false;
697 }
698 return true;
699}
700
701template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000702inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000703bool
704operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
705 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
706{
707 return !(__x == __y);
708}
709
710template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
711 class _Alloc = allocator<_Value> >
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000712class _LIBCPP_VISIBLE unordered_multiset
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000713{
714public:
715 // types
716 typedef _Value key_type;
717 typedef key_type value_type;
718 typedef _Hash hasher;
719 typedef _Pred key_equal;
720 typedef _Alloc allocator_type;
721 typedef value_type& reference;
722 typedef const value_type& const_reference;
723
724private:
725 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
726
727 __table __table_;
728
729public:
730 typedef typename __table::pointer pointer;
731 typedef typename __table::const_pointer const_pointer;
732 typedef typename __table::size_type size_type;
733 typedef typename __table::difference_type difference_type;
734
735 typedef typename __table::const_iterator iterator;
736 typedef typename __table::const_iterator const_iterator;
737 typedef typename __table::const_local_iterator local_iterator;
738 typedef typename __table::const_local_iterator const_local_iterator;
739
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000740 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000741 unordered_multiset()
742 _NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
743 {} // = default
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000744 explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(),
745 const key_equal& __eql = key_equal());
746 unordered_multiset(size_type __n, const hasher& __hf,
747 const key_equal& __eql, const allocator_type& __a);
748 template <class _InputIterator>
749 unordered_multiset(_InputIterator __first, _InputIterator __last);
750 template <class _InputIterator>
751 unordered_multiset(_InputIterator __first, _InputIterator __last,
752 size_type __n, const hasher& __hf = hasher(),
753 const key_equal& __eql = key_equal());
754 template <class _InputIterator>
755 unordered_multiset(_InputIterator __first, _InputIterator __last,
756 size_type __n , const hasher& __hf,
757 const key_equal& __eql, const allocator_type& __a);
758 explicit unordered_multiset(const allocator_type& __a);
759 unordered_multiset(const unordered_multiset& __u);
760 unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
Howard Hinnant73d21a42010-09-04 23:28:19 +0000761#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000762 unordered_multiset(unordered_multiset&& __u)
763 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000764 unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
Howard Hinnant73d21a42010-09-04 23:28:19 +0000765#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000766 unordered_multiset(initializer_list<value_type> __il);
767 unordered_multiset(initializer_list<value_type> __il, size_type __n,
768 const hasher& __hf = hasher(),
769 const key_equal& __eql = key_equal());
770 unordered_multiset(initializer_list<value_type> __il, size_type __n,
771 const hasher& __hf, const key_equal& __eql,
772 const allocator_type& __a);
773 // ~unordered_multiset() = default;
Howard Hinnant61aa6012011-07-01 19:24:36 +0000774 _LIBCPP_INLINE_VISIBILITY
775 unordered_multiset& operator=(const unordered_multiset& __u)
776 {
777 __table_ = __u.__table_;
778 return *this;
779 }
Howard Hinnant73d21a42010-09-04 23:28:19 +0000780#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000781 unordered_multiset& operator=(unordered_multiset&& __u)
782 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000783#endif
784 unordered_multiset& operator=(initializer_list<value_type> __il);
785
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000786 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000787 allocator_type get_allocator() const _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000788 {return allocator_type(__table_.__node_alloc());}
789
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000790 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000791 bool empty() const _NOEXCEPT {return __table_.size() == 0;}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000792 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000793 size_type size() const _NOEXCEPT {return __table_.size();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000794 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000795 size_type max_size() const _NOEXCEPT {return __table_.max_size();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000796
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000797 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000798 iterator begin() _NOEXCEPT {return __table_.begin();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000799 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000800 iterator end() _NOEXCEPT {return __table_.end();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000801 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000802 const_iterator begin() const _NOEXCEPT {return __table_.begin();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000803 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000804 const_iterator end() const _NOEXCEPT {return __table_.end();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000805 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000806 const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000807 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000808 const_iterator cend() const _NOEXCEPT {return __table_.end();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000809
Howard Hinnant73d21a42010-09-04 23:28:19 +0000810#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000811 template <class... _Args>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000812 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000813 iterator emplace(_Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000814 {return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000815 template <class... _Args>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000816 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000817 iterator emplace_hint(const_iterator __p, _Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000818 {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
Howard Hinnant73d21a42010-09-04 23:28:19 +0000819#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000820 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000821 iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
Howard Hinnant73d21a42010-09-04 23:28:19 +0000822#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000823 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant0949eed2011-06-30 21:18:19 +0000824 iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000825#endif
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000826 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000827 iterator insert(const_iterator __p, const value_type& __x)
828 {return __table_.__insert_multi(__p, __x);}
Howard Hinnant73d21a42010-09-04 23:28:19 +0000829#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000830 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000831 iterator insert(const_iterator __p, value_type&& __x)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000832 {return __table_.__insert_multi(__p, _VSTD::move(__x));}
Howard Hinnant73d21a42010-09-04 23:28:19 +0000833#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000834 template <class _InputIterator>
835 void insert(_InputIterator __first, _InputIterator __last);
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000836 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000837 void insert(initializer_list<value_type> __il)
838 {insert(__il.begin(), __il.end());}
839
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000840 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000841 iterator erase(const_iterator __p) {return __table_.erase(__p);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000842 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000843 size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000844 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000845 iterator erase(const_iterator __first, const_iterator __last)
846 {return __table_.erase(__first, __last);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000847 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000848 void clear() _NOEXCEPT {__table_.clear();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000849
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000850 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000851 void swap(unordered_multiset& __u)
852 _NOEXCEPT_(__is_nothrow_swappable<__table>::value)
853 {__table_.swap(__u.__table_);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000854
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000855 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000856 hasher hash_function() const {return __table_.hash_function();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000857 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000858 key_equal key_eq() const {return __table_.key_eq();}
859
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000860 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000861 iterator find(const key_type& __k) {return __table_.find(__k);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000862 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000863 const_iterator find(const key_type& __k) const {return __table_.find(__k);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000864 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000865 size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000866 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000867 pair<iterator, iterator> equal_range(const key_type& __k)
868 {return __table_.__equal_range_multi(__k);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000869 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000870 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
871 {return __table_.__equal_range_multi(__k);}
872
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000873 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000874 size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000875 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000876 size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000877
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000878 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000879 size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000880 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000881 size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
882
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000883 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000884 local_iterator begin(size_type __n) {return __table_.begin(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000885 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000886 local_iterator end(size_type __n) {return __table_.end(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000887 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000888 const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000889 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000890 const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000891 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000892 const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000893 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000894 const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
895
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000896 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000897 float load_factor() const _NOEXCEPT {return __table_.load_factor();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000898 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000899 float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000900 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000901 void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000902 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000903 void rehash(size_type __n) {__table_.rehash(__n);}
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000904 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000905 void reserve(size_type __n) {__table_.reserve(__n);}
906};
907
908template <class _Value, class _Hash, class _Pred, class _Alloc>
909unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
910 size_type __n, const hasher& __hf, const key_equal& __eql)
911 : __table_(__hf, __eql)
912{
913 __table_.rehash(__n);
914}
915
916template <class _Value, class _Hash, class _Pred, class _Alloc>
917unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
918 size_type __n, const hasher& __hf, const key_equal& __eql,
919 const allocator_type& __a)
920 : __table_(__hf, __eql, __a)
921{
922 __table_.rehash(__n);
923}
924
925template <class _Value, class _Hash, class _Pred, class _Alloc>
926template <class _InputIterator>
927unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
928 _InputIterator __first, _InputIterator __last)
929{
930 insert(__first, __last);
931}
932
933template <class _Value, class _Hash, class _Pred, class _Alloc>
934template <class _InputIterator>
935unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
936 _InputIterator __first, _InputIterator __last, size_type __n,
937 const hasher& __hf, const key_equal& __eql)
938 : __table_(__hf, __eql)
939{
940 __table_.rehash(__n);
941 insert(__first, __last);
942}
943
944template <class _Value, class _Hash, class _Pred, class _Alloc>
945template <class _InputIterator>
946unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
947 _InputIterator __first, _InputIterator __last, size_type __n,
948 const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
949 : __table_(__hf, __eql, __a)
950{
951 __table_.rehash(__n);
952 insert(__first, __last);
953}
954
955template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000956inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000957unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
958 const allocator_type& __a)
959 : __table_(__a)
960{
961}
962
963template <class _Value, class _Hash, class _Pred, class _Alloc>
964unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
965 const unordered_multiset& __u)
966 : __table_(__u.__table_)
967{
968 __table_.rehash(__u.bucket_count());
969 insert(__u.begin(), __u.end());
970}
971
972template <class _Value, class _Hash, class _Pred, class _Alloc>
973unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
974 const unordered_multiset& __u, const allocator_type& __a)
975 : __table_(__u.__table_, __a)
976{
977 __table_.rehash(__u.bucket_count());
978 insert(__u.begin(), __u.end());
979}
980
Howard Hinnant73d21a42010-09-04 23:28:19 +0000981#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000982
983template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +0000984inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000985unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
986 unordered_multiset&& __u)
Howard Hinnant04dae1d2011-06-04 20:18:37 +0000987 _NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000988 : __table_(_VSTD::move(__u.__table_))
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000989{
990}
991
992template <class _Value, class _Hash, class _Pred, class _Alloc>
993unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
994 unordered_multiset&& __u, const allocator_type& __a)
Howard Hinnant0949eed2011-06-30 21:18:19 +0000995 : __table_(_VSTD::move(__u.__table_), __a)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000996{
997 if (__a != __u.get_allocator())
998 {
999 iterator __i = __u.begin();
1000 while (__u.size() != 0)
Howard Hinnant0949eed2011-06-30 21:18:19 +00001001 __table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_));
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001002 }
1003}
1004
Howard Hinnant73d21a42010-09-04 23:28:19 +00001005#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001006
1007template <class _Value, class _Hash, class _Pred, class _Alloc>
1008unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
1009 initializer_list<value_type> __il)
1010{
1011 insert(__il.begin(), __il.end());
1012}
1013
1014template <class _Value, class _Hash, class _Pred, class _Alloc>
1015unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
1016 initializer_list<value_type> __il, size_type __n, const hasher& __hf,
1017 const key_equal& __eql)
1018 : __table_(__hf, __eql)
1019{
1020 __table_.rehash(__n);
1021 insert(__il.begin(), __il.end());
1022}
1023
1024template <class _Value, class _Hash, class _Pred, class _Alloc>
1025unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
1026 initializer_list<value_type> __il, size_type __n, const hasher& __hf,
1027 const key_equal& __eql, const allocator_type& __a)
1028 : __table_(__hf, __eql, __a)
1029{
1030 __table_.rehash(__n);
1031 insert(__il.begin(), __il.end());
1032}
1033
Howard Hinnant73d21a42010-09-04 23:28:19 +00001034#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001035
1036template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +00001037inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001038unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
1039unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
1040 unordered_multiset&& __u)
Howard Hinnant04dae1d2011-06-04 20:18:37 +00001041 _NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001042{
Howard Hinnant0949eed2011-06-30 21:18:19 +00001043 __table_ = _VSTD::move(__u.__table_);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001044 return *this;
1045}
1046
Howard Hinnant73d21a42010-09-04 23:28:19 +00001047#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001048
1049template <class _Value, class _Hash, class _Pred, class _Alloc>
1050inline
1051unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
1052unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
1053 initializer_list<value_type> __il)
1054{
1055 __table_.__assign_multi(__il.begin(), __il.end());
1056 return *this;
1057}
1058
1059template <class _Value, class _Hash, class _Pred, class _Alloc>
1060template <class _InputIterator>
Howard Hinnantee6ccd02010-09-23 18:58:28 +00001061inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001062void
1063unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
1064 _InputIterator __last)
1065{
1066 for (; __first != __last; ++__first)
1067 __table_.__insert_multi(*__first);
1068}
1069
1070template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +00001071inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001072void
1073swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1074 unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
Howard Hinnant04dae1d2011-06-04 20:18:37 +00001075 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001076{
1077 __x.swap(__y);
1078}
1079
1080template <class _Value, class _Hash, class _Pred, class _Alloc>
1081bool
1082operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1083 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1084{
1085 if (__x.size() != __y.size())
1086 return false;
1087 typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator
1088 const_iterator;
1089 typedef pair<const_iterator, const_iterator> _EqRng;
1090 for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;)
1091 {
1092 _EqRng __xeq = __x.equal_range(*__i);
1093 _EqRng __yeq = __y.equal_range(*__i);
Howard Hinnant0949eed2011-06-30 21:18:19 +00001094 if (_VSTD::distance(__xeq.first, __xeq.second) !=
1095 _VSTD::distance(__yeq.first, __yeq.second) ||
1096 !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001097 return false;
1098 __i = __xeq.second;
1099 }
1100 return true;
1101}
1102
1103template <class _Value, class _Hash, class _Pred, class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28 +00001104inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001105bool
1106operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1107 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1108{
1109 return !(__x == __y);
1110}
1111
1112_LIBCPP_END_NAMESPACE_STD
1113
1114#endif // _LIBCPP_UNORDERED_SET