blob: 70b8d28f7e5bc18d31905bb6e4340f1889458beb [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:161// -*- C++ -*-
2//===---------------------------- set -------------------------------------===//
3//
Howard Hinnantf5256e12010-05-11 21:36:014// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:165//
Howard Hinnantb64f8b02010-11-16 22:09:026// 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:168//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_SET
12#define _LIBCPP_SET
13
14/*
15
16 set synopsis
17
18namespace std
19{
20
21template <class Key, class Compare = less<Key>,
22 class Allocator = allocator<Key>>
23class set
24{
25public:
26 // types:
27 typedef Key key_type;
28 typedef key_type value_type;
29 typedef Compare key_compare;
30 typedef key_compare value_compare;
31 typedef Allocator allocator_type;
32 typedef typename allocator_type::reference reference;
33 typedef typename allocator_type::const_reference const_reference;
34 typedef typename allocator_type::size_type size_type;
35 typedef typename allocator_type::difference_type difference_type;
36 typedef typename allocator_type::pointer pointer;
37 typedef typename allocator_type::const_pointer const_pointer;
38
39 typedef implementation-defined iterator;
40 typedef implementation-defined const_iterator;
41 typedef std::reverse_iterator<iterator> reverse_iterator;
42 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
43
44 // construct/copy/destroy:
Howard Hinnantb2e2a8f2011-06-04 15:22:3445 set()
46 noexcept(
47 is_nothrow_default_constructible<allocator_type>::value &&
48 is_nothrow_default_constructible<key_compare>::value &&
49 is_nothrow_copy_constructible<key_compare>::value);
50 explicit set(const value_compare& comp);
Howard Hinnantbc8d3f92010-05-11 19:42:1651 set(const value_compare& comp, const allocator_type& a);
52 template <class InputIterator>
53 set(InputIterator first, InputIterator last,
54 const value_compare& comp = value_compare());
55 template <class InputIterator>
56 set(InputIterator first, InputIterator last, const value_compare& comp,
57 const allocator_type& a);
58 set(const set& s);
Howard Hinnantb2e2a8f2011-06-04 15:22:3459 set(set&& s)
60 noexcept(
61 is_nothrow_move_constructible<allocator_type>::value &&
62 is_nothrow_move_constructible<key_compare>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:1663 explicit set(const allocator_type& a);
64 set(const set& s, const allocator_type& a);
65 set(set&& s, const allocator_type& a);
66 set(initializer_list<value_type> il, const value_compare& comp = value_compare());
67 set(initializer_list<value_type> il, const value_compare& comp,
68 const allocator_type& a);
69 ~set();
70
71 set& operator=(const set& s);
Howard Hinnantb2e2a8f2011-06-04 15:22:3472 set& operator=(set&& s)
73 noexcept(
74 allocator_type::propagate_on_container_move_assignment::value &&
75 is_nothrow_move_assignable<allocator_type>::value &&
76 is_nothrow_move_assignable<key_compare>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:1677 set& operator=(initializer_list<value_type> il);
78
79 // iterators:
Howard Hinnantb2e2a8f2011-06-04 15:22:3480 iterator begin() noexcept;
81 const_iterator begin() const noexcept;
82 iterator end() noexcept;
83 const_iterator end() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:1684
Howard Hinnantb2e2a8f2011-06-04 15:22:3485 reverse_iterator rbegin() noexcept;
86 const_reverse_iterator rbegin() const noexcept;
87 reverse_iterator rend() noexcept;
88 const_reverse_iterator rend() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:1689
Howard Hinnantb2e2a8f2011-06-04 15:22:3490 const_iterator cbegin() const noexcept;
91 const_iterator cend() const noexcept;
92 const_reverse_iterator crbegin() const noexcept;
93 const_reverse_iterator crend() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:1694
95 // capacity:
Howard Hinnantb2e2a8f2011-06-04 15:22:3496 bool empty() const noexcept;
97 size_type size() const noexcept;
98 size_type max_size() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:1699
100 // modifiers:
101 template <class... Args>
102 pair<iterator, bool> emplace(Args&&... args);
103 template <class... Args>
104 iterator emplace_hint(const_iterator position, Args&&... args);
105 pair<iterator,bool> insert(const value_type& v);
106 pair<iterator,bool> insert(value_type&& v);
107 iterator insert(const_iterator position, const value_type& v);
108 iterator insert(const_iterator position, value_type&& v);
109 template <class InputIterator>
110 void insert(InputIterator first, InputIterator last);
111 void insert(initializer_list<value_type> il);
112
113 iterator erase(const_iterator position);
114 size_type erase(const key_type& k);
115 iterator erase(const_iterator first, const_iterator last);
Howard Hinnantb2e2a8f2011-06-04 15:22:34116 void clear() noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16117
Howard Hinnantb2e2a8f2011-06-04 15:22:34118 void swap(set& s)
119 noexcept(
120 __is_nothrow_swappable<key_compare>::value &&
121 (!allocator_type::propagate_on_container_swap::value ||
122 __is_nothrow_swappable<allocator_type>::value));
Howard Hinnantbc8d3f92010-05-11 19:42:16123
124 // observers:
Howard Hinnantb2e2a8f2011-06-04 15:22:34125 allocator_type get_allocator() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16126 key_compare key_comp() const;
127 value_compare value_comp() const;
128
129 // set operations:
130 iterator find(const key_type& k);
131 const_iterator find(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06132 template<typename K>
133 iterator find(const K& x);
134 template<typename K>
135 const_iterator find(const K& x) const; // C++14
136 template<typename K>
137 size_type count(const K& x) const; // C++14
138
Howard Hinnantbc8d3f92010-05-11 19:42:16139 size_type count(const key_type& k) const;
140 iterator lower_bound(const key_type& k);
141 const_iterator lower_bound(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06142 template<typename K>
143 iterator lower_bound(const K& x); // C++14
144 template<typename K>
145 const_iterator lower_bound(const K& x) const; // C++14
146
Howard Hinnantbc8d3f92010-05-11 19:42:16147 iterator upper_bound(const key_type& k);
148 const_iterator upper_bound(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06149 template<typename K>
150 iterator upper_bound(const K& x); // C++14
151 template<typename K>
152 const_iterator upper_bound(const K& x) const; // C++14
Howard Hinnantbc8d3f92010-05-11 19:42:16153 pair<iterator,iterator> equal_range(const key_type& k);
154 pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06155 template<typename K>
156 pair<iterator,iterator> equal_range(const K& x); // C++14
157 template<typename K>
158 pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
Howard Hinnantbc8d3f92010-05-11 19:42:16159};
160
161template <class Key, class Compare, class Allocator>
162bool
163operator==(const set<Key, Compare, Allocator>& x,
164 const set<Key, Compare, Allocator>& y);
165
166template <class Key, class Compare, class Allocator>
167bool
168operator< (const set<Key, Compare, Allocator>& x,
169 const set<Key, Compare, Allocator>& y);
170
171template <class Key, class Compare, class Allocator>
172bool
173operator!=(const set<Key, Compare, Allocator>& x,
174 const set<Key, Compare, Allocator>& y);
175
176template <class Key, class Compare, class Allocator>
177bool
178operator> (const set<Key, Compare, Allocator>& x,
179 const set<Key, Compare, Allocator>& y);
180
181template <class Key, class Compare, class Allocator>
182bool
183operator>=(const set<Key, Compare, Allocator>& x,
184 const set<Key, Compare, Allocator>& y);
185
186template <class Key, class Compare, class Allocator>
187bool
188operator<=(const set<Key, Compare, Allocator>& x,
189 const set<Key, Compare, Allocator>& y);
190
191// specialized algorithms:
192template <class Key, class Compare, class Allocator>
193void
Howard Hinnantb2e2a8f2011-06-04 15:22:34194swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y)
195 noexcept(noexcept(x.swap(y)));
Howard Hinnantbc8d3f92010-05-11 19:42:16196
Howard Hinnantbc8d3f92010-05-11 19:42:16197template <class Key, class Compare = less<Key>,
198 class Allocator = allocator<Key>>
199class multiset
200{
201public:
202 // types:
203 typedef Key key_type;
204 typedef key_type value_type;
205 typedef Compare key_compare;
206 typedef key_compare value_compare;
207 typedef Allocator allocator_type;
208 typedef typename allocator_type::reference reference;
209 typedef typename allocator_type::const_reference const_reference;
210 typedef typename allocator_type::size_type size_type;
211 typedef typename allocator_type::difference_type difference_type;
212 typedef typename allocator_type::pointer pointer;
213 typedef typename allocator_type::const_pointer const_pointer;
214
215 typedef implementation-defined iterator;
216 typedef implementation-defined const_iterator;
217 typedef std::reverse_iterator<iterator> reverse_iterator;
218 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
219
220 // construct/copy/destroy:
Howard Hinnantb2e2a8f2011-06-04 15:22:34221 multiset()
222 noexcept(
223 is_nothrow_default_constructible<allocator_type>::value &&
224 is_nothrow_default_constructible<key_compare>::value &&
225 is_nothrow_copy_constructible<key_compare>::value);
226 explicit multiset(const value_compare& comp);
Howard Hinnantbc8d3f92010-05-11 19:42:16227 multiset(const value_compare& comp, const allocator_type& a);
228 template <class InputIterator>
229 multiset(InputIterator first, InputIterator last,
230 const value_compare& comp = value_compare());
231 template <class InputIterator>
232 multiset(InputIterator first, InputIterator last,
233 const value_compare& comp, const allocator_type& a);
234 multiset(const multiset& s);
Howard Hinnantb2e2a8f2011-06-04 15:22:34235 multiset(multiset&& s)
236 noexcept(
237 is_nothrow_move_constructible<allocator_type>::value &&
238 is_nothrow_move_constructible<key_compare>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16239 explicit multiset(const allocator_type& a);
240 multiset(const multiset& s, const allocator_type& a);
241 multiset(multiset&& s, const allocator_type& a);
242 multiset(initializer_list<value_type> il, const value_compare& comp = value_compare());
243 multiset(initializer_list<value_type> il, const value_compare& comp,
244 const allocator_type& a);
245 ~multiset();
246
247 multiset& operator=(const multiset& s);
Howard Hinnantb2e2a8f2011-06-04 15:22:34248 multiset& operator=(multiset&& s)
249 noexcept(
250 allocator_type::propagate_on_container_move_assignment::value &&
251 is_nothrow_move_assignable<allocator_type>::value &&
252 is_nothrow_move_assignable<key_compare>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16253 multiset& operator=(initializer_list<value_type> il);
254
255 // iterators:
Howard Hinnantb2e2a8f2011-06-04 15:22:34256 iterator begin() noexcept;
257 const_iterator begin() const noexcept;
258 iterator end() noexcept;
259 const_iterator end() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16260
Howard Hinnantb2e2a8f2011-06-04 15:22:34261 reverse_iterator rbegin() noexcept;
262 const_reverse_iterator rbegin() const noexcept;
263 reverse_iterator rend() noexcept;
264 const_reverse_iterator rend() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16265
Howard Hinnantb2e2a8f2011-06-04 15:22:34266 const_iterator cbegin() const noexcept;
267 const_iterator cend() const noexcept;
268 const_reverse_iterator crbegin() const noexcept;
269 const_reverse_iterator crend() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16270
271 // capacity:
Howard Hinnantb2e2a8f2011-06-04 15:22:34272 bool empty() const noexcept;
273 size_type size() const noexcept;
274 size_type max_size() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16275
276 // modifiers:
277 template <class... Args>
278 iterator emplace(Args&&... args);
279 template <class... Args>
280 iterator emplace_hint(const_iterator position, Args&&... args);
281 iterator insert(const value_type& v);
282 iterator insert(value_type&& v);
283 iterator insert(const_iterator position, const value_type& v);
284 iterator insert(const_iterator position, value_type&& v);
285 template <class InputIterator>
286 void insert(InputIterator first, InputIterator last);
287 void insert(initializer_list<value_type> il);
288
289 iterator erase(const_iterator position);
290 size_type erase(const key_type& k);
291 iterator erase(const_iterator first, const_iterator last);
Howard Hinnantb2e2a8f2011-06-04 15:22:34292 void clear() noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16293
Howard Hinnantb2e2a8f2011-06-04 15:22:34294 void swap(multiset& s)
295 noexcept(
296 __is_nothrow_swappable<key_compare>::value &&
297 (!allocator_type::propagate_on_container_swap::value ||
298 __is_nothrow_swappable<allocator_type>::value));
Howard Hinnantbc8d3f92010-05-11 19:42:16299
300 // observers:
Howard Hinnantb2e2a8f2011-06-04 15:22:34301 allocator_type get_allocator() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16302 key_compare key_comp() const;
303 value_compare value_comp() const;
304
305 // set operations:
306 iterator find(const key_type& k);
307 const_iterator find(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06308 template<typename K>
309 iterator find(const K& x);
310 template<typename K>
311 const_iterator find(const K& x) const; // C++14
312
Howard Hinnantbc8d3f92010-05-11 19:42:16313 size_type count(const key_type& k) const;
314 iterator lower_bound(const key_type& k);
315 const_iterator lower_bound(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06316 template<typename K>
317 iterator lower_bound(const K& x); // C++14
318 template<typename K>
319 const_iterator lower_bound(const K& x) const; // C++14
320
Howard Hinnantbc8d3f92010-05-11 19:42:16321 iterator upper_bound(const key_type& k);
322 const_iterator upper_bound(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06323 template<typename K>
324 iterator upper_bound(const K& x); // C++14
325 template<typename K>
326 const_iterator upper_bound(const K& x) const; // C++14
327
Howard Hinnantbc8d3f92010-05-11 19:42:16328 pair<iterator,iterator> equal_range(const key_type& k);
329 pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06330 template<typename K>
331 pair<iterator,iterator> equal_range(const K& x); // C++14
332 template<typename K>
333 pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
Howard Hinnantbc8d3f92010-05-11 19:42:16334};
335
336template <class Key, class Compare, class Allocator>
337bool
338operator==(const multiset<Key, Compare, Allocator>& x,
339 const multiset<Key, Compare, Allocator>& y);
340
341template <class Key, class Compare, class Allocator>
342bool
343operator< (const multiset<Key, Compare, Allocator>& x,
344 const multiset<Key, Compare, Allocator>& y);
345
346template <class Key, class Compare, class Allocator>
347bool
348operator!=(const multiset<Key, Compare, Allocator>& x,
349 const multiset<Key, Compare, Allocator>& y);
350
351template <class Key, class Compare, class Allocator>
352bool
353operator> (const multiset<Key, Compare, Allocator>& x,
354 const multiset<Key, Compare, Allocator>& y);
355
356template <class Key, class Compare, class Allocator>
357bool
358operator>=(const multiset<Key, Compare, Allocator>& x,
359 const multiset<Key, Compare, Allocator>& y);
360
361template <class Key, class Compare, class Allocator>
362bool
363operator<=(const multiset<Key, Compare, Allocator>& x,
364 const multiset<Key, Compare, Allocator>& y);
365
366// specialized algorithms:
367template <class Key, class Compare, class Allocator>
368void
Howard Hinnantb2e2a8f2011-06-04 15:22:34369swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
370 noexcept(noexcept(x.swap(y)));
Howard Hinnantbc8d3f92010-05-11 19:42:16371
372} // std
373
374*/
375
376#include <__config>
377#include <__tree>
378#include <functional>
379
Howard Hinnant08e17472011-10-17 20:05:10380#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Howard Hinnantbc8d3f92010-05-11 19:42:16381#pragma GCC system_header
Howard Hinnant08e17472011-10-17 20:05:10382#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16383
384_LIBCPP_BEGIN_NAMESPACE_STD
385
386template <class _Key, class _Compare = less<_Key>,
387 class _Allocator = allocator<_Key> >
Howard Hinnant0f678bd2013-08-12 18:38:34388class _LIBCPP_TYPE_VIS_ONLY set
Howard Hinnantbc8d3f92010-05-11 19:42:16389{
390public:
391 // types:
392 typedef _Key key_type;
393 typedef key_type value_type;
394 typedef _Compare key_compare;
395 typedef key_compare value_compare;
396 typedef _Allocator allocator_type;
397 typedef value_type& reference;
398 typedef const value_type& const_reference;
399
400private:
401 typedef __tree<value_type, value_compare, allocator_type> __base;
402 typedef allocator_traits<allocator_type> __alloc_traits;
403 typedef typename __base::__node_holder __node_holder;
404
405 __base __tree_;
406
407public:
408 typedef typename __base::pointer pointer;
409 typedef typename __base::const_pointer const_pointer;
410 typedef typename __base::size_type size_type;
411 typedef typename __base::difference_type difference_type;
412 typedef typename __base::const_iterator iterator;
413 typedef typename __base::const_iterator const_iterator;
Howard Hinnant0949eed2011-06-30 21:18:19414 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
415 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
Howard Hinnantbc8d3f92010-05-11 19:42:16416
Howard Hinnant28c97e62010-09-23 16:27:36417 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16418 explicit set(const value_compare& __comp = value_compare())
Howard Hinnantb2e2a8f2011-06-04 15:22:34419 _NOEXCEPT_(
420 is_nothrow_default_constructible<allocator_type>::value &&
421 is_nothrow_default_constructible<key_compare>::value &&
422 is_nothrow_copy_constructible<key_compare>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16423 : __tree_(__comp) {}
Howard Hinnant28c97e62010-09-23 16:27:36424 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16425 set(const value_compare& __comp, const allocator_type& __a)
426 : __tree_(__comp, __a) {}
427 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36428 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16429 set(_InputIterator __f, _InputIterator __l,
430 const value_compare& __comp = value_compare())
431 : __tree_(__comp)
432 {
433 insert(__f, __l);
434 }
435
436 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36437 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16438 set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
439 const allocator_type& __a)
440 : __tree_(__comp, __a)
441 {
442 insert(__f, __l);
443 }
444
Howard Hinnant28c97e62010-09-23 16:27:36445 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16446 set(const set& __s)
447 : __tree_(__s.__tree_)
448 {
449 insert(__s.begin(), __s.end());
450 }
451
Howard Hinnant61aa6012011-07-01 19:24:36452 _LIBCPP_INLINE_VISIBILITY
453 set& operator=(const set& __s)
454 {
455 __tree_ = __s.__tree_;
456 return *this;
457 }
458
Howard Hinnant73d21a42010-09-04 23:28:19459#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36460 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16461 set(set&& __s)
Howard Hinnantb2e2a8f2011-06-04 15:22:34462 _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
Howard Hinnant0949eed2011-06-30 21:18:19463 : __tree_(_VSTD::move(__s.__tree_)) {}
Howard Hinnant73d21a42010-09-04 23:28:19464#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16465
Howard Hinnant28c97e62010-09-23 16:27:36466 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16467 explicit set(const allocator_type& __a)
468 : __tree_(__a) {}
469
Howard Hinnant28c97e62010-09-23 16:27:36470 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16471 set(const set& __s, const allocator_type& __a)
472 : __tree_(__s.__tree_.value_comp(), __a)
473 {
474 insert(__s.begin(), __s.end());
475 }
476
Howard Hinnant73d21a42010-09-04 23:28:19477#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16478 set(set&& __s, const allocator_type& __a);
479#endif
480
Howard Hinnante3e32912011-08-12 21:56:02481#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnant28c97e62010-09-23 16:27:36482 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16483 set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
484 : __tree_(__comp)
485 {
486 insert(__il.begin(), __il.end());
487 }
488
Howard Hinnant28c97e62010-09-23 16:27:36489 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16490 set(initializer_list<value_type> __il, const value_compare& __comp,
491 const allocator_type& __a)
492 : __tree_(__comp, __a)
493 {
494 insert(__il.begin(), __il.end());
495 }
496
Howard Hinnant28c97e62010-09-23 16:27:36497 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16498 set& operator=(initializer_list<value_type> __il)
499 {
500 __tree_.__assign_unique(__il.begin(), __il.end());
501 return *this;
502 }
Howard Hinnante3e32912011-08-12 21:56:02503#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnantbc8d3f92010-05-11 19:42:16504
Howard Hinnant73d21a42010-09-04 23:28:19505#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36506 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16507 set& operator=(set&& __s)
Howard Hinnantb2e2a8f2011-06-04 15:22:34508 _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16509 {
Howard Hinnant0949eed2011-06-30 21:18:19510 __tree_ = _VSTD::move(__s.__tree_);
Howard Hinnantbc8d3f92010-05-11 19:42:16511 return *this;
512 }
Howard Hinnant73d21a42010-09-04 23:28:19513#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16514
Howard Hinnant28c97e62010-09-23 16:27:36515 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34516 iterator begin() _NOEXCEPT {return __tree_.begin();}
Howard Hinnant28c97e62010-09-23 16:27:36517 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34518 const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
Howard Hinnant28c97e62010-09-23 16:27:36519 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34520 iterator end() _NOEXCEPT {return __tree_.end();}
Howard Hinnant28c97e62010-09-23 16:27:36521 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34522 const_iterator end() const _NOEXCEPT {return __tree_.end();}
Howard Hinnantbc8d3f92010-05-11 19:42:16523
Howard Hinnant28c97e62010-09-23 16:27:36524 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34525 reverse_iterator rbegin() _NOEXCEPT
526 {return reverse_iterator(end());}
Howard Hinnant28c97e62010-09-23 16:27:36527 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34528 const_reverse_iterator rbegin() const _NOEXCEPT
529 {return const_reverse_iterator(end());}
Howard Hinnant28c97e62010-09-23 16:27:36530 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34531 reverse_iterator rend() _NOEXCEPT
532 {return reverse_iterator(begin());}
Howard Hinnant28c97e62010-09-23 16:27:36533 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34534 const_reverse_iterator rend() const _NOEXCEPT
535 {return const_reverse_iterator(begin());}
Howard Hinnantbc8d3f92010-05-11 19:42:16536
Howard Hinnant28c97e62010-09-23 16:27:36537 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34538 const_iterator cbegin() const _NOEXCEPT {return begin();}
Howard Hinnant28c97e62010-09-23 16:27:36539 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34540 const_iterator cend() const _NOEXCEPT {return end();}
Howard Hinnant28c97e62010-09-23 16:27:36541 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34542 const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
Howard Hinnant28c97e62010-09-23 16:27:36543 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34544 const_reverse_iterator crend() const _NOEXCEPT {return rend();}
Howard Hinnantbc8d3f92010-05-11 19:42:16545
Howard Hinnant28c97e62010-09-23 16:27:36546 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34547 bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
Howard Hinnant28c97e62010-09-23 16:27:36548 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34549 size_type size() const _NOEXCEPT {return __tree_.size();}
Howard Hinnant28c97e62010-09-23 16:27:36550 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34551 size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
Howard Hinnantbc8d3f92010-05-11 19:42:16552
553 // modifiers:
Howard Hinnant73d21a42010-09-04 23:28:19554#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnantbc8d3f92010-05-11 19:42:16555 template <class... _Args>
Howard Hinnant28c97e62010-09-23 16:27:36556 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16557 pair<iterator, bool> emplace(_Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19558 {return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
Howard Hinnantbc8d3f92010-05-11 19:42:16559 template <class... _Args>
Howard Hinnant28c97e62010-09-23 16:27:36560 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16561 iterator emplace_hint(const_iterator __p, _Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19562 {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);}
Howard Hinnant73d21a42010-09-04 23:28:19563#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnant28c97e62010-09-23 16:27:36564 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16565 pair<iterator,bool> insert(const value_type& __v)
566 {return __tree_.__insert_unique(__v);}
Howard Hinnant73d21a42010-09-04 23:28:19567#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36568 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16569 pair<iterator,bool> insert(value_type&& __v)
Howard Hinnant0949eed2011-06-30 21:18:19570 {return __tree_.__insert_unique(_VSTD::move(__v));}
Howard Hinnant73d21a42010-09-04 23:28:19571#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36572 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16573 iterator insert(const_iterator __p, const value_type& __v)
574 {return __tree_.__insert_unique(__p, __v);}
Howard Hinnant73d21a42010-09-04 23:28:19575#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36576 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16577 iterator insert(const_iterator __p, value_type&& __v)
Howard Hinnant0949eed2011-06-30 21:18:19578 {return __tree_.__insert_unique(__p, _VSTD::move(__v));}
Howard Hinnant73d21a42010-09-04 23:28:19579#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16580 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36581 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16582 void insert(_InputIterator __f, _InputIterator __l)
583 {
584 for (const_iterator __e = cend(); __f != __l; ++__f)
585 __tree_.__insert_unique(__e, *__f);
586 }
587
Howard Hinnante3e32912011-08-12 21:56:02588#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnant28c97e62010-09-23 16:27:36589 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16590 void insert(initializer_list<value_type> __il)
591 {insert(__il.begin(), __il.end());}
Howard Hinnante3e32912011-08-12 21:56:02592#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnantbc8d3f92010-05-11 19:42:16593
Howard Hinnant28c97e62010-09-23 16:27:36594 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16595 iterator erase(const_iterator __p) {return __tree_.erase(__p);}
Howard Hinnant28c97e62010-09-23 16:27:36596 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16597 size_type erase(const key_type& __k)
598 {return __tree_.__erase_unique(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36599 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16600 iterator erase(const_iterator __f, const_iterator __l)
601 {return __tree_.erase(__f, __l);}
Howard Hinnant28c97e62010-09-23 16:27:36602 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34603 void clear() _NOEXCEPT {__tree_.clear();}
Howard Hinnantbc8d3f92010-05-11 19:42:16604
Howard Hinnant28c97e62010-09-23 16:27:36605 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34606 void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
607 {__tree_.swap(__s.__tree_);}
Howard Hinnantbc8d3f92010-05-11 19:42:16608
Howard Hinnant28c97e62010-09-23 16:27:36609 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34610 allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
Howard Hinnant28c97e62010-09-23 16:27:36611 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16612 key_compare key_comp() const {return __tree_.value_comp();}
Howard Hinnant28c97e62010-09-23 16:27:36613 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16614 value_compare value_comp() const {return __tree_.value_comp();}
615
616 // set operations:
Howard Hinnant28c97e62010-09-23 16:27:36617 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16618 iterator find(const key_type& __k) {return __tree_.find(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36619 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16620 const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
Marshall Clow4a0a9812013-08-13 01:11:06621#if _LIBCPP_STD_VER > 11
622 template <typename _K2>
623 _LIBCPP_INLINE_VISIBILITY
624 typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
625 find(const _K2& __k) {return __tree_.find(__k);}
626 template <typename _K2>
627 _LIBCPP_INLINE_VISIBILITY
628 typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
629 find(const _K2& __k) const {return __tree_.find(__k);}
630#endif
631
Howard Hinnant28c97e62010-09-23 16:27:36632 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16633 size_type count(const key_type& __k) const
634 {return __tree_.__count_unique(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36635 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16636 iterator lower_bound(const key_type& __k)
637 {return __tree_.lower_bound(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36638 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16639 const_iterator lower_bound(const key_type& __k) const
640 {return __tree_.lower_bound(__k);}
Marshall Clow4a0a9812013-08-13 01:11:06641#if _LIBCPP_STD_VER > 11
642 template <typename _K2>
643 _LIBCPP_INLINE_VISIBILITY
644 typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
645 lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
646
647 template <typename _K2>
648 _LIBCPP_INLINE_VISIBILITY
649 typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
650 lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
651#endif
652
Howard Hinnant28c97e62010-09-23 16:27:36653 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16654 iterator upper_bound(const key_type& __k)
655 {return __tree_.upper_bound(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36656 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16657 const_iterator upper_bound(const key_type& __k) const
658 {return __tree_.upper_bound(__k);}
Marshall Clow4a0a9812013-08-13 01:11:06659#if _LIBCPP_STD_VER > 11
660 template <typename _K2>
661 _LIBCPP_INLINE_VISIBILITY
662 typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
663 upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
664 template <typename _K2>
665 _LIBCPP_INLINE_VISIBILITY
666 typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
667 upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
668#endif
669
Howard Hinnant28c97e62010-09-23 16:27:36670 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16671 pair<iterator,iterator> equal_range(const key_type& __k)
672 {return __tree_.__equal_range_unique(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36673 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16674 pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
675 {return __tree_.__equal_range_unique(__k);}
Marshall Clow4a0a9812013-08-13 01:11:06676#if _LIBCPP_STD_VER > 11
677 template <typename _K2>
678 _LIBCPP_INLINE_VISIBILITY
679 typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
680 equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);}
681 template <typename _K2>
682 _LIBCPP_INLINE_VISIBILITY
683 typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
684 equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);}
685#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16686};
687
Howard Hinnant73d21a42010-09-04 23:28:19688#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16689
690template <class _Key, class _Compare, class _Allocator>
691set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
Howard Hinnant0949eed2011-06-30 21:18:19692 : __tree_(_VSTD::move(__s.__tree_), __a)
Howard Hinnantbc8d3f92010-05-11 19:42:16693{
694 if (__a != __s.get_allocator())
695 {
696 const_iterator __e = cend();
697 while (!__s.empty())
Howard Hinnant0949eed2011-06-30 21:18:19698 insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
Howard Hinnantbc8d3f92010-05-11 19:42:16699 }
700}
701
Howard Hinnant73d21a42010-09-04 23:28:19702#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16703
704template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36705inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16706bool
707operator==(const set<_Key, _Compare, _Allocator>& __x,
708 const set<_Key, _Compare, _Allocator>& __y)
709{
Howard Hinnant0949eed2011-06-30 21:18:19710 return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
Howard Hinnantbc8d3f92010-05-11 19:42:16711}
712
713template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36714inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16715bool
716operator< (const set<_Key, _Compare, _Allocator>& __x,
717 const set<_Key, _Compare, _Allocator>& __y)
718{
Howard Hinnant0949eed2011-06-30 21:18:19719 return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
Howard Hinnantbc8d3f92010-05-11 19:42:16720}
721
722template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36723inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16724bool
725operator!=(const set<_Key, _Compare, _Allocator>& __x,
726 const set<_Key, _Compare, _Allocator>& __y)
727{
728 return !(__x == __y);
729}
730
731template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36732inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16733bool
734operator> (const set<_Key, _Compare, _Allocator>& __x,
735 const set<_Key, _Compare, _Allocator>& __y)
736{
737 return __y < __x;
738}
739
740template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36741inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16742bool
743operator>=(const set<_Key, _Compare, _Allocator>& __x,
744 const set<_Key, _Compare, _Allocator>& __y)
745{
746 return !(__x < __y);
747}
748
749template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36750inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16751bool
752operator<=(const set<_Key, _Compare, _Allocator>& __x,
753 const set<_Key, _Compare, _Allocator>& __y)
754{
755 return !(__y < __x);
756}
757
758// specialized algorithms:
759template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36760inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16761void
762swap(set<_Key, _Compare, _Allocator>& __x,
763 set<_Key, _Compare, _Allocator>& __y)
Howard Hinnantb2e2a8f2011-06-04 15:22:34764 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
Howard Hinnantbc8d3f92010-05-11 19:42:16765{
766 __x.swap(__y);
767}
768
Howard Hinnantbc8d3f92010-05-11 19:42:16769template <class _Key, class _Compare = less<_Key>,
770 class _Allocator = allocator<_Key> >
Howard Hinnant0f678bd2013-08-12 18:38:34771class _LIBCPP_TYPE_VIS_ONLY multiset
Howard Hinnantbc8d3f92010-05-11 19:42:16772{
773public:
774 // types:
775 typedef _Key key_type;
776 typedef key_type value_type;
777 typedef _Compare key_compare;
778 typedef key_compare value_compare;
779 typedef _Allocator allocator_type;
780 typedef value_type& reference;
781 typedef const value_type& const_reference;
782
783private:
784 typedef __tree<value_type, value_compare, allocator_type> __base;
785 typedef allocator_traits<allocator_type> __alloc_traits;
786 typedef typename __base::__node_holder __node_holder;
787
788 __base __tree_;
789
790public:
791 typedef typename __base::pointer pointer;
792 typedef typename __base::const_pointer const_pointer;
793 typedef typename __base::size_type size_type;
794 typedef typename __base::difference_type difference_type;
795 typedef typename __base::const_iterator iterator;
796 typedef typename __base::const_iterator const_iterator;
Howard Hinnant0949eed2011-06-30 21:18:19797 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
798 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
Howard Hinnantbc8d3f92010-05-11 19:42:16799
800 // construct/copy/destroy:
Howard Hinnant28c97e62010-09-23 16:27:36801 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16802 explicit multiset(const value_compare& __comp = value_compare())
Howard Hinnantb2e2a8f2011-06-04 15:22:34803 _NOEXCEPT_(
804 is_nothrow_default_constructible<allocator_type>::value &&
805 is_nothrow_default_constructible<key_compare>::value &&
806 is_nothrow_copy_constructible<key_compare>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16807 : __tree_(__comp) {}
Howard Hinnant28c97e62010-09-23 16:27:36808 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16809 multiset(const value_compare& __comp, const allocator_type& __a)
810 : __tree_(__comp, __a) {}
811 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36812 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16813 multiset(_InputIterator __f, _InputIterator __l,
814 const value_compare& __comp = value_compare())
815 : __tree_(__comp)
816 {
817 insert(__f, __l);
818 }
819
820 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36821 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16822 multiset(_InputIterator __f, _InputIterator __l,
823 const value_compare& __comp, const allocator_type& __a)
824 : __tree_(__comp, __a)
825 {
826 insert(__f, __l);
827 }
828
Howard Hinnant28c97e62010-09-23 16:27:36829 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16830 multiset(const multiset& __s)
831 : __tree_(__s.__tree_.value_comp(),
832 __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
833 {
834 insert(__s.begin(), __s.end());
835 }
836
Howard Hinnant61aa6012011-07-01 19:24:36837 _LIBCPP_INLINE_VISIBILITY
838 multiset& operator=(const multiset& __s)
839 {
840 __tree_ = __s.__tree_;
841 return *this;
842 }
843
Howard Hinnant73d21a42010-09-04 23:28:19844#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36845 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16846 multiset(multiset&& __s)
Howard Hinnantb2e2a8f2011-06-04 15:22:34847 _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
Howard Hinnant0949eed2011-06-30 21:18:19848 : __tree_(_VSTD::move(__s.__tree_)) {}
Howard Hinnant73d21a42010-09-04 23:28:19849#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36850 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16851 explicit multiset(const allocator_type& __a)
852 : __tree_(__a) {}
Howard Hinnant28c97e62010-09-23 16:27:36853 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16854 multiset(const multiset& __s, const allocator_type& __a)
855 : __tree_(__s.__tree_.value_comp(), __a)
856 {
857 insert(__s.begin(), __s.end());
858 }
Howard Hinnant73d21a42010-09-04 23:28:19859#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16860 multiset(multiset&& __s, const allocator_type& __a);
861#endif
862
Howard Hinnante3e32912011-08-12 21:56:02863#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnant28c97e62010-09-23 16:27:36864 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16865 multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
866 : __tree_(__comp)
867 {
868 insert(__il.begin(), __il.end());
869 }
870
Howard Hinnant28c97e62010-09-23 16:27:36871 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16872 multiset(initializer_list<value_type> __il, const value_compare& __comp,
873 const allocator_type& __a)
874 : __tree_(__comp, __a)
875 {
876 insert(__il.begin(), __il.end());
877 }
878
Howard Hinnant28c97e62010-09-23 16:27:36879 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16880 multiset& operator=(initializer_list<value_type> __il)
881 {
882 __tree_.__assign_multi(__il.begin(), __il.end());
883 return *this;
884 }
Howard Hinnante3e32912011-08-12 21:56:02885#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnantbc8d3f92010-05-11 19:42:16886
Howard Hinnant73d21a42010-09-04 23:28:19887#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36888 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16889 multiset& operator=(multiset&& __s)
Howard Hinnantb2e2a8f2011-06-04 15:22:34890 _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16891 {
Howard Hinnant0949eed2011-06-30 21:18:19892 __tree_ = _VSTD::move(__s.__tree_);
Howard Hinnantbc8d3f92010-05-11 19:42:16893 return *this;
894 }
Howard Hinnant73d21a42010-09-04 23:28:19895#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16896
Howard Hinnant28c97e62010-09-23 16:27:36897 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34898 iterator begin() _NOEXCEPT {return __tree_.begin();}
Howard Hinnant28c97e62010-09-23 16:27:36899 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34900 const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
Howard Hinnant28c97e62010-09-23 16:27:36901 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34902 iterator end() _NOEXCEPT {return __tree_.end();}
Howard Hinnant28c97e62010-09-23 16:27:36903 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34904 const_iterator end() const _NOEXCEPT {return __tree_.end();}
Howard Hinnantbc8d3f92010-05-11 19:42:16905
Howard Hinnant28c97e62010-09-23 16:27:36906 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34907 reverse_iterator rbegin() _NOEXCEPT
908 {return reverse_iterator(end());}
Howard Hinnant28c97e62010-09-23 16:27:36909 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34910 const_reverse_iterator rbegin() const _NOEXCEPT
911 {return const_reverse_iterator(end());}
Howard Hinnant28c97e62010-09-23 16:27:36912 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34913 reverse_iterator rend() _NOEXCEPT
914 {return reverse_iterator(begin());}
Howard Hinnant28c97e62010-09-23 16:27:36915 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34916 const_reverse_iterator rend() const _NOEXCEPT
917 {return const_reverse_iterator(begin());}
Howard Hinnantbc8d3f92010-05-11 19:42:16918
Howard Hinnant28c97e62010-09-23 16:27:36919 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34920 const_iterator cbegin() const _NOEXCEPT {return begin();}
Howard Hinnant28c97e62010-09-23 16:27:36921 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34922 const_iterator cend() const _NOEXCEPT {return end();}
Howard Hinnant28c97e62010-09-23 16:27:36923 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34924 const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
Howard Hinnant28c97e62010-09-23 16:27:36925 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34926 const_reverse_iterator crend() const _NOEXCEPT {return rend();}
Howard Hinnantbc8d3f92010-05-11 19:42:16927
Howard Hinnant28c97e62010-09-23 16:27:36928 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34929 bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
Howard Hinnant28c97e62010-09-23 16:27:36930 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34931 size_type size() const _NOEXCEPT {return __tree_.size();}
Howard Hinnant28c97e62010-09-23 16:27:36932 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34933 size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
Howard Hinnantbc8d3f92010-05-11 19:42:16934
935 // modifiers:
Howard Hinnant73d21a42010-09-04 23:28:19936#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnantbc8d3f92010-05-11 19:42:16937 template <class... _Args>
Howard Hinnant28c97e62010-09-23 16:27:36938 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16939 iterator emplace(_Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19940 {return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
Howard Hinnantbc8d3f92010-05-11 19:42:16941 template <class... _Args>
Howard Hinnant28c97e62010-09-23 16:27:36942 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16943 iterator emplace_hint(const_iterator __p, _Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19944 {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
Howard Hinnant73d21a42010-09-04 23:28:19945#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnant28c97e62010-09-23 16:27:36946 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16947 iterator insert(const value_type& __v)
948 {return __tree_.__insert_multi(__v);}
Howard Hinnant73d21a42010-09-04 23:28:19949#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36950 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16951 iterator insert(value_type&& __v)
Howard Hinnant0949eed2011-06-30 21:18:19952 {return __tree_.__insert_multi(_VSTD::move(__v));}
Howard Hinnant73d21a42010-09-04 23:28:19953#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36954 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16955 iterator insert(const_iterator __p, const value_type& __v)
956 {return __tree_.__insert_multi(__p, __v);}
Howard Hinnant73d21a42010-09-04 23:28:19957#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36958 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16959 iterator insert(const_iterator __p, value_type&& __v)
Howard Hinnant0949eed2011-06-30 21:18:19960 {return __tree_.__insert_multi(_VSTD::move(__v));}
Howard Hinnant73d21a42010-09-04 23:28:19961#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16962 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36963 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16964 void insert(_InputIterator __f, _InputIterator __l)
965 {
966 for (const_iterator __e = cend(); __f != __l; ++__f)
967 __tree_.__insert_multi(__e, *__f);
968 }
969
Howard Hinnante3e32912011-08-12 21:56:02970#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnant28c97e62010-09-23 16:27:36971 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16972 void insert(initializer_list<value_type> __il)
973 {insert(__il.begin(), __il.end());}
Howard Hinnante3e32912011-08-12 21:56:02974#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnantbc8d3f92010-05-11 19:42:16975
Howard Hinnant28c97e62010-09-23 16:27:36976 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16977 iterator erase(const_iterator __p) {return __tree_.erase(__p);}
Howard Hinnant28c97e62010-09-23 16:27:36978 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16979 size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36980 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16981 iterator erase(const_iterator __f, const_iterator __l)
982 {return __tree_.erase(__f, __l);}
Howard Hinnant28c97e62010-09-23 16:27:36983 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34984 void clear() _NOEXCEPT {__tree_.clear();}
Howard Hinnantbc8d3f92010-05-11 19:42:16985
Howard Hinnant28c97e62010-09-23 16:27:36986 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34987 void swap(multiset& __s)
988 _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
989 {__tree_.swap(__s.__tree_);}
Howard Hinnantbc8d3f92010-05-11 19:42:16990
Howard Hinnant28c97e62010-09-23 16:27:36991 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34992 allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
Howard Hinnant28c97e62010-09-23 16:27:36993 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16994 key_compare key_comp() const {return __tree_.value_comp();}
Howard Hinnant28c97e62010-09-23 16:27:36995 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16996 value_compare value_comp() const {return __tree_.value_comp();}
997
998 // set operations:
Howard Hinnant28c97e62010-09-23 16:27:36999 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161000 iterator find(const key_type& __k) {return __tree_.find(__k);}
Howard Hinnant28c97e62010-09-23 16:27:361001 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161002 const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
Marshall Clow4a0a9812013-08-13 01:11:061003#if _LIBCPP_STD_VER > 11
1004 template <typename _K2>
1005 _LIBCPP_INLINE_VISIBILITY
1006 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
1007 find(const _K2& __k) {return __tree_.find(__k);}
1008 template <typename _K2>
1009 _LIBCPP_INLINE_VISIBILITY
1010 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
1011 find(const _K2& __k) const {return __tree_.find(__k);}
1012#endif
1013
Howard Hinnant28c97e62010-09-23 16:27:361014 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161015 size_type count(const key_type& __k) const
1016 {return __tree_.__count_multi(__k);}
Marshall Clow4a0a9812013-08-13 01:11:061017
Howard Hinnant28c97e62010-09-23 16:27:361018 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161019 iterator lower_bound(const key_type& __k)
1020 {return __tree_.lower_bound(__k);}
Howard Hinnant28c97e62010-09-23 16:27:361021 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161022 const_iterator lower_bound(const key_type& __k) const
1023 {return __tree_.lower_bound(__k);}
Marshall Clow4a0a9812013-08-13 01:11:061024#if _LIBCPP_STD_VER > 11
1025 template <typename _K2>
1026 _LIBCPP_INLINE_VISIBILITY
1027 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
1028 lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
1029
1030 template <typename _K2>
1031 _LIBCPP_INLINE_VISIBILITY
1032 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
1033 lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
1034#endif
1035
Howard Hinnant28c97e62010-09-23 16:27:361036 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161037 iterator upper_bound(const key_type& __k)
1038 {return __tree_.upper_bound(__k);}
Howard Hinnant28c97e62010-09-23 16:27:361039 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161040 const_iterator upper_bound(const key_type& __k) const
1041 {return __tree_.upper_bound(__k);}
Marshall Clow4a0a9812013-08-13 01:11:061042#if _LIBCPP_STD_VER > 11
1043 template <typename _K2>
1044 _LIBCPP_INLINE_VISIBILITY
1045 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
1046 upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
1047 template <typename _K2>
1048 _LIBCPP_INLINE_VISIBILITY
1049 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
1050 upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
1051#endif
1052
Howard Hinnant28c97e62010-09-23 16:27:361053 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161054 pair<iterator,iterator> equal_range(const key_type& __k)
1055 {return __tree_.__equal_range_multi(__k);}
Howard Hinnant28c97e62010-09-23 16:27:361056 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161057 pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
1058 {return __tree_.__equal_range_multi(__k);}
Marshall Clow4a0a9812013-08-13 01:11:061059#if _LIBCPP_STD_VER > 11
1060 template <typename _K2>
1061 _LIBCPP_INLINE_VISIBILITY
1062 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
1063 equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
1064 template <typename _K2>
1065 _LIBCPP_INLINE_VISIBILITY
1066 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
1067 equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
1068#endif
Howard Hinnantbc8d3f92010-05-11 19:42:161069};
1070
Howard Hinnant73d21a42010-09-04 23:28:191071#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:161072
1073template <class _Key, class _Compare, class _Allocator>
1074multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
Howard Hinnant0949eed2011-06-30 21:18:191075 : __tree_(_VSTD::move(__s.__tree_), __a)
Howard Hinnantbc8d3f92010-05-11 19:42:161076{
1077 if (__a != __s.get_allocator())
1078 {
1079 const_iterator __e = cend();
1080 while (!__s.empty())
Howard Hinnant0949eed2011-06-30 21:18:191081 insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
Howard Hinnantbc8d3f92010-05-11 19:42:161082 }
1083}
1084
Howard Hinnant73d21a42010-09-04 23:28:191085#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:161086
1087template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361088inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161089bool
1090operator==(const multiset<_Key, _Compare, _Allocator>& __x,
1091 const multiset<_Key, _Compare, _Allocator>& __y)
1092{
Howard Hinnant0949eed2011-06-30 21:18:191093 return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
Howard Hinnantbc8d3f92010-05-11 19:42:161094}
1095
1096template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361097inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161098bool
1099operator< (const multiset<_Key, _Compare, _Allocator>& __x,
1100 const multiset<_Key, _Compare, _Allocator>& __y)
1101{
Howard Hinnant0949eed2011-06-30 21:18:191102 return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
Howard Hinnantbc8d3f92010-05-11 19:42:161103}
1104
1105template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361106inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161107bool
1108operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
1109 const multiset<_Key, _Compare, _Allocator>& __y)
1110{
1111 return !(__x == __y);
1112}
1113
1114template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361115inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161116bool
1117operator> (const multiset<_Key, _Compare, _Allocator>& __x,
1118 const multiset<_Key, _Compare, _Allocator>& __y)
1119{
1120 return __y < __x;
1121}
1122
1123template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361124inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161125bool
1126operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
1127 const multiset<_Key, _Compare, _Allocator>& __y)
1128{
1129 return !(__x < __y);
1130}
1131
1132template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361133inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161134bool
1135operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
1136 const multiset<_Key, _Compare, _Allocator>& __y)
1137{
1138 return !(__y < __x);
1139}
1140
1141template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361142inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161143void
1144swap(multiset<_Key, _Compare, _Allocator>& __x,
1145 multiset<_Key, _Compare, _Allocator>& __y)
Howard Hinnantb2e2a8f2011-06-04 15:22:341146 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
Howard Hinnantbc8d3f92010-05-11 19:42:161147{
1148 __x.swap(__y);
1149}
1150
Howard Hinnantbc8d3f92010-05-11 19:42:161151_LIBCPP_END_NAMESPACE_STD
1152
1153#endif // _LIBCPP_SET