blob: 22d794da547af6a2c204376a3701d59344a319e5 [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);
Marshall Clow24a7e332013-09-11 00:06:4569 template <class InputIterator>
70 set(InputIterator first, InputIterator last, const allocator_type& a)
71 : set(first, last, Compare(), a) {} // C++14
72 set(initializer_list<value_type> il, const allocator_type& a)
73 : set(il, Compare(), a) {} // C++14
Howard Hinnantbc8d3f92010-05-11 19:42:1674 ~set();
75
76 set& operator=(const set& s);
Howard Hinnantb2e2a8f2011-06-04 15:22:3477 set& operator=(set&& s)
78 noexcept(
79 allocator_type::propagate_on_container_move_assignment::value &&
80 is_nothrow_move_assignable<allocator_type>::value &&
81 is_nothrow_move_assignable<key_compare>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:1682 set& operator=(initializer_list<value_type> il);
83
84 // iterators:
Howard Hinnantb2e2a8f2011-06-04 15:22:3485 iterator begin() noexcept;
86 const_iterator begin() const noexcept;
87 iterator end() noexcept;
88 const_iterator end() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:1689
Howard Hinnantb2e2a8f2011-06-04 15:22:3490 reverse_iterator rbegin() noexcept;
91 const_reverse_iterator rbegin() const noexcept;
92 reverse_iterator rend() noexcept;
93 const_reverse_iterator rend() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:1694
Howard Hinnantb2e2a8f2011-06-04 15:22:3495 const_iterator cbegin() const noexcept;
96 const_iterator cend() const noexcept;
97 const_reverse_iterator crbegin() const noexcept;
98 const_reverse_iterator crend() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:1699
100 // capacity:
Howard Hinnantb2e2a8f2011-06-04 15:22:34101 bool empty() const noexcept;
102 size_type size() const noexcept;
103 size_type max_size() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16104
105 // modifiers:
106 template <class... Args>
107 pair<iterator, bool> emplace(Args&&... args);
108 template <class... Args>
109 iterator emplace_hint(const_iterator position, Args&&... args);
110 pair<iterator,bool> insert(const value_type& v);
111 pair<iterator,bool> insert(value_type&& v);
112 iterator insert(const_iterator position, const value_type& v);
113 iterator insert(const_iterator position, value_type&& v);
114 template <class InputIterator>
115 void insert(InputIterator first, InputIterator last);
116 void insert(initializer_list<value_type> il);
117
118 iterator erase(const_iterator position);
119 size_type erase(const key_type& k);
120 iterator erase(const_iterator first, const_iterator last);
Howard Hinnantb2e2a8f2011-06-04 15:22:34121 void clear() noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16122
Howard Hinnantb2e2a8f2011-06-04 15:22:34123 void swap(set& s)
124 noexcept(
125 __is_nothrow_swappable<key_compare>::value &&
126 (!allocator_type::propagate_on_container_swap::value ||
127 __is_nothrow_swappable<allocator_type>::value));
Howard Hinnantbc8d3f92010-05-11 19:42:16128
129 // observers:
Howard Hinnantb2e2a8f2011-06-04 15:22:34130 allocator_type get_allocator() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16131 key_compare key_comp() const;
132 value_compare value_comp() const;
133
134 // set operations:
135 iterator find(const key_type& k);
136 const_iterator find(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06137 template<typename K>
138 iterator find(const K& x);
139 template<typename K>
140 const_iterator find(const K& x) const; // C++14
141 template<typename K>
142 size_type count(const K& x) const; // C++14
143
Howard Hinnantbc8d3f92010-05-11 19:42:16144 size_type count(const key_type& k) const;
145 iterator lower_bound(const key_type& k);
146 const_iterator lower_bound(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06147 template<typename K>
148 iterator lower_bound(const K& x); // C++14
149 template<typename K>
150 const_iterator lower_bound(const K& x) const; // C++14
151
Howard Hinnantbc8d3f92010-05-11 19:42:16152 iterator upper_bound(const key_type& k);
153 const_iterator upper_bound(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06154 template<typename K>
155 iterator upper_bound(const K& x); // C++14
156 template<typename K>
157 const_iterator upper_bound(const K& x) const; // C++14
Howard Hinnantbc8d3f92010-05-11 19:42:16158 pair<iterator,iterator> equal_range(const key_type& k);
159 pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06160 template<typename K>
161 pair<iterator,iterator> equal_range(const K& x); // C++14
162 template<typename K>
163 pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
Howard Hinnantbc8d3f92010-05-11 19:42:16164};
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
191template <class Key, class Compare, class Allocator>
192bool
193operator<=(const set<Key, Compare, Allocator>& x,
194 const set<Key, Compare, Allocator>& y);
195
196// specialized algorithms:
197template <class Key, class Compare, class Allocator>
198void
Howard Hinnantb2e2a8f2011-06-04 15:22:34199swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y)
200 noexcept(noexcept(x.swap(y)));
Howard Hinnantbc8d3f92010-05-11 19:42:16201
Howard Hinnantbc8d3f92010-05-11 19:42:16202template <class Key, class Compare = less<Key>,
203 class Allocator = allocator<Key>>
204class multiset
205{
206public:
207 // types:
208 typedef Key key_type;
209 typedef key_type value_type;
210 typedef Compare key_compare;
211 typedef key_compare value_compare;
212 typedef Allocator allocator_type;
213 typedef typename allocator_type::reference reference;
214 typedef typename allocator_type::const_reference const_reference;
215 typedef typename allocator_type::size_type size_type;
216 typedef typename allocator_type::difference_type difference_type;
217 typedef typename allocator_type::pointer pointer;
218 typedef typename allocator_type::const_pointer const_pointer;
219
220 typedef implementation-defined iterator;
221 typedef implementation-defined const_iterator;
222 typedef std::reverse_iterator<iterator> reverse_iterator;
223 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
224
225 // construct/copy/destroy:
Howard Hinnantb2e2a8f2011-06-04 15:22:34226 multiset()
227 noexcept(
228 is_nothrow_default_constructible<allocator_type>::value &&
229 is_nothrow_default_constructible<key_compare>::value &&
230 is_nothrow_copy_constructible<key_compare>::value);
231 explicit multiset(const value_compare& comp);
Howard Hinnantbc8d3f92010-05-11 19:42:16232 multiset(const value_compare& comp, const allocator_type& a);
233 template <class InputIterator>
234 multiset(InputIterator first, InputIterator last,
235 const value_compare& comp = value_compare());
236 template <class InputIterator>
237 multiset(InputIterator first, InputIterator last,
238 const value_compare& comp, const allocator_type& a);
239 multiset(const multiset& s);
Howard Hinnantb2e2a8f2011-06-04 15:22:34240 multiset(multiset&& s)
241 noexcept(
242 is_nothrow_move_constructible<allocator_type>::value &&
243 is_nothrow_move_constructible<key_compare>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16244 explicit multiset(const allocator_type& a);
245 multiset(const multiset& s, const allocator_type& a);
246 multiset(multiset&& s, const allocator_type& a);
247 multiset(initializer_list<value_type> il, const value_compare& comp = value_compare());
248 multiset(initializer_list<value_type> il, const value_compare& comp,
249 const allocator_type& a);
Marshall Clow24a7e332013-09-11 00:06:45250 template <class InputIterator>
251 multiset(InputIterator first, InputIterator last, const allocator_type& a)
252 : set(first, last, Compare(), a) {} // C++14
253 multiset(initializer_list<value_type> il, const allocator_type& a)
254 : set(il, Compare(), a) {} // C++14
Howard Hinnantbc8d3f92010-05-11 19:42:16255 ~multiset();
256
257 multiset& operator=(const multiset& s);
Howard Hinnantb2e2a8f2011-06-04 15:22:34258 multiset& operator=(multiset&& s)
259 noexcept(
260 allocator_type::propagate_on_container_move_assignment::value &&
261 is_nothrow_move_assignable<allocator_type>::value &&
262 is_nothrow_move_assignable<key_compare>::value);
Howard Hinnantbc8d3f92010-05-11 19:42:16263 multiset& operator=(initializer_list<value_type> il);
264
265 // iterators:
Howard Hinnantb2e2a8f2011-06-04 15:22:34266 iterator begin() noexcept;
267 const_iterator begin() const noexcept;
268 iterator end() noexcept;
269 const_iterator end() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16270
Howard Hinnantb2e2a8f2011-06-04 15:22:34271 reverse_iterator rbegin() noexcept;
272 const_reverse_iterator rbegin() const noexcept;
273 reverse_iterator rend() noexcept;
274 const_reverse_iterator rend() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16275
Howard Hinnantb2e2a8f2011-06-04 15:22:34276 const_iterator cbegin() const noexcept;
277 const_iterator cend() const noexcept;
278 const_reverse_iterator crbegin() const noexcept;
279 const_reverse_iterator crend() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16280
281 // capacity:
Howard Hinnantb2e2a8f2011-06-04 15:22:34282 bool empty() const noexcept;
283 size_type size() const noexcept;
284 size_type max_size() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16285
286 // modifiers:
287 template <class... Args>
288 iterator emplace(Args&&... args);
289 template <class... Args>
290 iterator emplace_hint(const_iterator position, Args&&... args);
291 iterator insert(const value_type& v);
292 iterator insert(value_type&& v);
293 iterator insert(const_iterator position, const value_type& v);
294 iterator insert(const_iterator position, value_type&& v);
295 template <class InputIterator>
296 void insert(InputIterator first, InputIterator last);
297 void insert(initializer_list<value_type> il);
298
299 iterator erase(const_iterator position);
300 size_type erase(const key_type& k);
301 iterator erase(const_iterator first, const_iterator last);
Howard Hinnantb2e2a8f2011-06-04 15:22:34302 void clear() noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16303
Howard Hinnantb2e2a8f2011-06-04 15:22:34304 void swap(multiset& s)
305 noexcept(
306 __is_nothrow_swappable<key_compare>::value &&
307 (!allocator_type::propagate_on_container_swap::value ||
308 __is_nothrow_swappable<allocator_type>::value));
Howard Hinnantbc8d3f92010-05-11 19:42:16309
310 // observers:
Howard Hinnantb2e2a8f2011-06-04 15:22:34311 allocator_type get_allocator() const noexcept;
Howard Hinnantbc8d3f92010-05-11 19:42:16312 key_compare key_comp() const;
313 value_compare value_comp() const;
314
315 // set operations:
316 iterator find(const key_type& k);
317 const_iterator find(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06318 template<typename K>
319 iterator find(const K& x);
320 template<typename K>
321 const_iterator find(const K& x) const; // C++14
322
Howard Hinnantbc8d3f92010-05-11 19:42:16323 size_type count(const key_type& k) const;
324 iterator lower_bound(const key_type& k);
325 const_iterator lower_bound(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06326 template<typename K>
327 iterator lower_bound(const K& x); // C++14
328 template<typename K>
329 const_iterator lower_bound(const K& x) const; // C++14
330
Howard Hinnantbc8d3f92010-05-11 19:42:16331 iterator upper_bound(const key_type& k);
332 const_iterator upper_bound(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06333 template<typename K>
334 iterator upper_bound(const K& x); // C++14
335 template<typename K>
336 const_iterator upper_bound(const K& x) const; // C++14
337
Howard Hinnantbc8d3f92010-05-11 19:42:16338 pair<iterator,iterator> equal_range(const key_type& k);
339 pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
Marshall Clow4a0a9812013-08-13 01:11:06340 template<typename K>
341 pair<iterator,iterator> equal_range(const K& x); // C++14
342 template<typename K>
343 pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
Howard Hinnantbc8d3f92010-05-11 19:42:16344};
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
366template <class Key, class Compare, class Allocator>
367bool
368operator>=(const multiset<Key, Compare, Allocator>& x,
369 const multiset<Key, Compare, Allocator>& y);
370
371template <class Key, class Compare, class Allocator>
372bool
373operator<=(const multiset<Key, Compare, Allocator>& x,
374 const multiset<Key, Compare, Allocator>& y);
375
376// specialized algorithms:
377template <class Key, class Compare, class Allocator>
378void
Howard Hinnantb2e2a8f2011-06-04 15:22:34379swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
380 noexcept(noexcept(x.swap(y)));
Howard Hinnantbc8d3f92010-05-11 19:42:16381
382} // std
383
384*/
385
386#include <__config>
387#include <__tree>
388#include <functional>
389
Howard Hinnant08e17472011-10-17 20:05:10390#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Howard Hinnantbc8d3f92010-05-11 19:42:16391#pragma GCC system_header
Howard Hinnant08e17472011-10-17 20:05:10392#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16393
394_LIBCPP_BEGIN_NAMESPACE_STD
395
396template <class _Key, class _Compare = less<_Key>,
397 class _Allocator = allocator<_Key> >
Howard Hinnant0f678bd2013-08-12 18:38:34398class _LIBCPP_TYPE_VIS_ONLY set
Howard Hinnantbc8d3f92010-05-11 19:42:16399{
400public:
401 // types:
402 typedef _Key key_type;
403 typedef key_type value_type;
404 typedef _Compare key_compare;
405 typedef key_compare value_compare;
406 typedef _Allocator allocator_type;
407 typedef value_type& reference;
408 typedef const value_type& const_reference;
409
410private:
411 typedef __tree<value_type, value_compare, allocator_type> __base;
412 typedef allocator_traits<allocator_type> __alloc_traits;
413 typedef typename __base::__node_holder __node_holder;
414
415 __base __tree_;
416
417public:
418 typedef typename __base::pointer pointer;
419 typedef typename __base::const_pointer const_pointer;
420 typedef typename __base::size_type size_type;
421 typedef typename __base::difference_type difference_type;
422 typedef typename __base::const_iterator iterator;
423 typedef typename __base::const_iterator const_iterator;
Howard Hinnant0949eed2011-06-30 21:18:19424 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
425 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
Howard Hinnantbc8d3f92010-05-11 19:42:16426
Howard Hinnant28c97e62010-09-23 16:27:36427 _LIBCPP_INLINE_VISIBILITY
Marshall Clowcaaa1412014-03-10 04:50:10428 set()
429 _NOEXCEPT_(
430 is_nothrow_default_constructible<allocator_type>::value &&
431 is_nothrow_default_constructible<key_compare>::value &&
432 is_nothrow_copy_constructible<key_compare>::value)
433 : __tree_(value_compare()) {}
434
435 _LIBCPP_INLINE_VISIBILITY
436 explicit set(const value_compare& __comp)
Howard Hinnantb2e2a8f2011-06-04 15:22:34437 _NOEXCEPT_(
438 is_nothrow_default_constructible<allocator_type>::value &&
Howard Hinnantb2e2a8f2011-06-04 15:22:34439 is_nothrow_copy_constructible<key_compare>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16440 : __tree_(__comp) {}
Marshall Clowcaaa1412014-03-10 04:50:10441
Howard Hinnant28c97e62010-09-23 16:27:36442 _LIBCPP_INLINE_VISIBILITY
Marshall Clow48c74702014-03-05 19:06:20443 explicit set(const value_compare& __comp, const allocator_type& __a)
Howard Hinnantbc8d3f92010-05-11 19:42:16444 : __tree_(__comp, __a) {}
445 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36446 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16447 set(_InputIterator __f, _InputIterator __l,
448 const value_compare& __comp = value_compare())
449 : __tree_(__comp)
450 {
451 insert(__f, __l);
452 }
453
454 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36455 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16456 set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
457 const allocator_type& __a)
458 : __tree_(__comp, __a)
459 {
460 insert(__f, __l);
461 }
462
Marshall Clow24a7e332013-09-11 00:06:45463#if _LIBCPP_STD_VER > 11
464 template <class _InputIterator>
465 _LIBCPP_INLINE_VISIBILITY
466 set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
467 : set(__f, __l, key_compare(), __a) {}
468#endif
469
Howard Hinnant28c97e62010-09-23 16:27:36470 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16471 set(const set& __s)
472 : __tree_(__s.__tree_)
473 {
474 insert(__s.begin(), __s.end());
475 }
476
Howard Hinnant61aa6012011-07-01 19:24:36477 _LIBCPP_INLINE_VISIBILITY
478 set& operator=(const set& __s)
479 {
480 __tree_ = __s.__tree_;
481 return *this;
482 }
483
Howard Hinnant73d21a42010-09-04 23:28:19484#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36485 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16486 set(set&& __s)
Howard Hinnantb2e2a8f2011-06-04 15:22:34487 _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
Howard Hinnant0949eed2011-06-30 21:18:19488 : __tree_(_VSTD::move(__s.__tree_)) {}
Howard Hinnant73d21a42010-09-04 23:28:19489#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16490
Howard Hinnant28c97e62010-09-23 16:27:36491 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16492 explicit set(const allocator_type& __a)
493 : __tree_(__a) {}
494
Howard Hinnant28c97e62010-09-23 16:27:36495 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16496 set(const set& __s, const allocator_type& __a)
497 : __tree_(__s.__tree_.value_comp(), __a)
498 {
499 insert(__s.begin(), __s.end());
500 }
501
Howard Hinnant73d21a42010-09-04 23:28:19502#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16503 set(set&& __s, const allocator_type& __a);
504#endif
505
Howard Hinnante3e32912011-08-12 21:56:02506#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnant28c97e62010-09-23 16:27:36507 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16508 set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
509 : __tree_(__comp)
510 {
511 insert(__il.begin(), __il.end());
512 }
513
Howard Hinnant28c97e62010-09-23 16:27:36514 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16515 set(initializer_list<value_type> __il, const value_compare& __comp,
516 const allocator_type& __a)
517 : __tree_(__comp, __a)
518 {
519 insert(__il.begin(), __il.end());
520 }
521
Marshall Clow24a7e332013-09-11 00:06:45522#if _LIBCPP_STD_VER > 11
523 _LIBCPP_INLINE_VISIBILITY
524 set(initializer_list<value_type> __il, const allocator_type& __a)
525 : set(__il, key_compare(), __a) {}
526#endif
527
Howard Hinnant28c97e62010-09-23 16:27:36528 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16529 set& operator=(initializer_list<value_type> __il)
530 {
531 __tree_.__assign_unique(__il.begin(), __il.end());
532 return *this;
533 }
Howard Hinnante3e32912011-08-12 21:56:02534#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnantbc8d3f92010-05-11 19:42:16535
Howard Hinnant73d21a42010-09-04 23:28:19536#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36537 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16538 set& operator=(set&& __s)
Howard Hinnantb2e2a8f2011-06-04 15:22:34539 _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16540 {
Howard Hinnant0949eed2011-06-30 21:18:19541 __tree_ = _VSTD::move(__s.__tree_);
Howard Hinnantbc8d3f92010-05-11 19:42:16542 return *this;
543 }
Howard Hinnant73d21a42010-09-04 23:28:19544#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16545
Howard Hinnant28c97e62010-09-23 16:27:36546 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34547 iterator begin() _NOEXCEPT {return __tree_.begin();}
Howard Hinnant28c97e62010-09-23 16:27:36548 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34549 const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
Howard Hinnant28c97e62010-09-23 16:27:36550 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34551 iterator end() _NOEXCEPT {return __tree_.end();}
Howard Hinnant28c97e62010-09-23 16:27:36552 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34553 const_iterator end() const _NOEXCEPT {return __tree_.end();}
Howard Hinnantbc8d3f92010-05-11 19:42:16554
Howard Hinnant28c97e62010-09-23 16:27:36555 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34556 reverse_iterator rbegin() _NOEXCEPT
557 {return reverse_iterator(end());}
Howard Hinnant28c97e62010-09-23 16:27:36558 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34559 const_reverse_iterator rbegin() const _NOEXCEPT
560 {return const_reverse_iterator(end());}
Howard Hinnant28c97e62010-09-23 16:27:36561 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34562 reverse_iterator rend() _NOEXCEPT
563 {return reverse_iterator(begin());}
Howard Hinnant28c97e62010-09-23 16:27:36564 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34565 const_reverse_iterator rend() const _NOEXCEPT
566 {return const_reverse_iterator(begin());}
Howard Hinnantbc8d3f92010-05-11 19:42:16567
Howard Hinnant28c97e62010-09-23 16:27:36568 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34569 const_iterator cbegin() const _NOEXCEPT {return begin();}
Howard Hinnant28c97e62010-09-23 16:27:36570 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34571 const_iterator cend() const _NOEXCEPT {return end();}
Howard Hinnant28c97e62010-09-23 16:27:36572 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34573 const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
Howard Hinnant28c97e62010-09-23 16:27:36574 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34575 const_reverse_iterator crend() const _NOEXCEPT {return rend();}
Howard Hinnantbc8d3f92010-05-11 19:42:16576
Howard Hinnant28c97e62010-09-23 16:27:36577 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34578 bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
Howard Hinnant28c97e62010-09-23 16:27:36579 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34580 size_type size() const _NOEXCEPT {return __tree_.size();}
Howard Hinnant28c97e62010-09-23 16:27:36581 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34582 size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
Howard Hinnantbc8d3f92010-05-11 19:42:16583
584 // modifiers:
Howard Hinnant73d21a42010-09-04 23:28:19585#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnantbc8d3f92010-05-11 19:42:16586 template <class... _Args>
Howard Hinnant28c97e62010-09-23 16:27:36587 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16588 pair<iterator, bool> emplace(_Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19589 {return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
Howard Hinnantbc8d3f92010-05-11 19:42:16590 template <class... _Args>
Howard Hinnant28c97e62010-09-23 16:27:36591 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16592 iterator emplace_hint(const_iterator __p, _Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19593 {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);}
Howard Hinnant73d21a42010-09-04 23:28:19594#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnant28c97e62010-09-23 16:27:36595 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16596 pair<iterator,bool> insert(const value_type& __v)
597 {return __tree_.__insert_unique(__v);}
Howard Hinnant73d21a42010-09-04 23:28:19598#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36599 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16600 pair<iterator,bool> insert(value_type&& __v)
Howard Hinnant0949eed2011-06-30 21:18:19601 {return __tree_.__insert_unique(_VSTD::move(__v));}
Howard Hinnant73d21a42010-09-04 23:28:19602#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36603 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16604 iterator insert(const_iterator __p, const value_type& __v)
605 {return __tree_.__insert_unique(__p, __v);}
Howard Hinnant73d21a42010-09-04 23:28:19606#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36607 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16608 iterator insert(const_iterator __p, value_type&& __v)
Howard Hinnant0949eed2011-06-30 21:18:19609 {return __tree_.__insert_unique(__p, _VSTD::move(__v));}
Howard Hinnant73d21a42010-09-04 23:28:19610#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16611 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36612 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16613 void insert(_InputIterator __f, _InputIterator __l)
614 {
615 for (const_iterator __e = cend(); __f != __l; ++__f)
616 __tree_.__insert_unique(__e, *__f);
617 }
618
Howard Hinnante3e32912011-08-12 21:56:02619#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnant28c97e62010-09-23 16:27:36620 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16621 void insert(initializer_list<value_type> __il)
622 {insert(__il.begin(), __il.end());}
Howard Hinnante3e32912011-08-12 21:56:02623#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnantbc8d3f92010-05-11 19:42:16624
Howard Hinnant28c97e62010-09-23 16:27:36625 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16626 iterator erase(const_iterator __p) {return __tree_.erase(__p);}
Howard Hinnant28c97e62010-09-23 16:27:36627 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16628 size_type erase(const key_type& __k)
629 {return __tree_.__erase_unique(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36630 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16631 iterator erase(const_iterator __f, const_iterator __l)
632 {return __tree_.erase(__f, __l);}
Howard Hinnant28c97e62010-09-23 16:27:36633 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34634 void clear() _NOEXCEPT {__tree_.clear();}
Howard Hinnantbc8d3f92010-05-11 19:42:16635
Howard Hinnant28c97e62010-09-23 16:27:36636 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34637 void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
638 {__tree_.swap(__s.__tree_);}
Howard Hinnantbc8d3f92010-05-11 19:42:16639
Howard Hinnant28c97e62010-09-23 16:27:36640 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34641 allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
Howard Hinnant28c97e62010-09-23 16:27:36642 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16643 key_compare key_comp() const {return __tree_.value_comp();}
Howard Hinnant28c97e62010-09-23 16:27:36644 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16645 value_compare value_comp() const {return __tree_.value_comp();}
646
647 // set operations:
Howard Hinnant28c97e62010-09-23 16:27:36648 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16649 iterator find(const key_type& __k) {return __tree_.find(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36650 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16651 const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
Marshall Clow4a0a9812013-08-13 01:11:06652#if _LIBCPP_STD_VER > 11
653 template <typename _K2>
654 _LIBCPP_INLINE_VISIBILITY
655 typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
656 find(const _K2& __k) {return __tree_.find(__k);}
657 template <typename _K2>
658 _LIBCPP_INLINE_VISIBILITY
659 typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
660 find(const _K2& __k) const {return __tree_.find(__k);}
661#endif
662
Howard Hinnant28c97e62010-09-23 16:27:36663 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16664 size_type count(const key_type& __k) const
665 {return __tree_.__count_unique(__k);}
Marshall Clow4de32042014-08-24 23:54:16666#if _LIBCPP_STD_VER > 11
667 template <typename _K2>
668 _LIBCPP_INLINE_VISIBILITY
669 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
670 count(const _K2& __k) {return __tree_.__count_unique(__k);}
671#endif
Howard Hinnant28c97e62010-09-23 16:27:36672 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16673 iterator lower_bound(const key_type& __k)
674 {return __tree_.lower_bound(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36675 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16676 const_iterator lower_bound(const key_type& __k) const
677 {return __tree_.lower_bound(__k);}
Marshall Clow4a0a9812013-08-13 01:11:06678#if _LIBCPP_STD_VER > 11
679 template <typename _K2>
680 _LIBCPP_INLINE_VISIBILITY
681 typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
682 lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
683
684 template <typename _K2>
685 _LIBCPP_INLINE_VISIBILITY
686 typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
687 lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
688#endif
689
Howard Hinnant28c97e62010-09-23 16:27:36690 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16691 iterator upper_bound(const key_type& __k)
692 {return __tree_.upper_bound(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36693 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16694 const_iterator upper_bound(const key_type& __k) const
695 {return __tree_.upper_bound(__k);}
Marshall Clow4a0a9812013-08-13 01:11:06696#if _LIBCPP_STD_VER > 11
697 template <typename _K2>
698 _LIBCPP_INLINE_VISIBILITY
699 typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
700 upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
701 template <typename _K2>
702 _LIBCPP_INLINE_VISIBILITY
703 typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
704 upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
705#endif
706
Howard Hinnant28c97e62010-09-23 16:27:36707 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16708 pair<iterator,iterator> equal_range(const key_type& __k)
709 {return __tree_.__equal_range_unique(__k);}
Howard Hinnant28c97e62010-09-23 16:27:36710 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16711 pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
712 {return __tree_.__equal_range_unique(__k);}
Marshall Clow4a0a9812013-08-13 01:11:06713#if _LIBCPP_STD_VER > 11
714 template <typename _K2>
715 _LIBCPP_INLINE_VISIBILITY
716 typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
717 equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);}
718 template <typename _K2>
719 _LIBCPP_INLINE_VISIBILITY
720 typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
721 equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);}
722#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16723};
724
Howard Hinnant73d21a42010-09-04 23:28:19725#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16726
727template <class _Key, class _Compare, class _Allocator>
728set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
Howard Hinnant0949eed2011-06-30 21:18:19729 : __tree_(_VSTD::move(__s.__tree_), __a)
Howard Hinnantbc8d3f92010-05-11 19:42:16730{
731 if (__a != __s.get_allocator())
732 {
733 const_iterator __e = cend();
734 while (!__s.empty())
Howard Hinnant0949eed2011-06-30 21:18:19735 insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
Howard Hinnantbc8d3f92010-05-11 19:42:16736 }
737}
738
Howard Hinnant73d21a42010-09-04 23:28:19739#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16740
741template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36742inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16743bool
744operator==(const set<_Key, _Compare, _Allocator>& __x,
745 const set<_Key, _Compare, _Allocator>& __y)
746{
Howard Hinnant0949eed2011-06-30 21:18:19747 return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
Howard Hinnantbc8d3f92010-05-11 19:42:16748}
749
750template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36751inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16752bool
753operator< (const set<_Key, _Compare, _Allocator>& __x,
754 const set<_Key, _Compare, _Allocator>& __y)
755{
Howard Hinnant0949eed2011-06-30 21:18:19756 return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
Howard Hinnantbc8d3f92010-05-11 19:42:16757}
758
759template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36760inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16761bool
762operator!=(const set<_Key, _Compare, _Allocator>& __x,
763 const set<_Key, _Compare, _Allocator>& __y)
764{
765 return !(__x == __y);
766}
767
768template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36769inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16770bool
771operator> (const set<_Key, _Compare, _Allocator>& __x,
772 const set<_Key, _Compare, _Allocator>& __y)
773{
774 return __y < __x;
775}
776
777template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36778inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16779bool
780operator>=(const set<_Key, _Compare, _Allocator>& __x,
781 const set<_Key, _Compare, _Allocator>& __y)
782{
783 return !(__x < __y);
784}
785
786template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36787inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16788bool
789operator<=(const set<_Key, _Compare, _Allocator>& __x,
790 const set<_Key, _Compare, _Allocator>& __y)
791{
792 return !(__y < __x);
793}
794
795// specialized algorithms:
796template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:36797inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16798void
799swap(set<_Key, _Compare, _Allocator>& __x,
800 set<_Key, _Compare, _Allocator>& __y)
Howard Hinnantb2e2a8f2011-06-04 15:22:34801 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
Howard Hinnantbc8d3f92010-05-11 19:42:16802{
803 __x.swap(__y);
804}
805
Howard Hinnantbc8d3f92010-05-11 19:42:16806template <class _Key, class _Compare = less<_Key>,
807 class _Allocator = allocator<_Key> >
Howard Hinnant0f678bd2013-08-12 18:38:34808class _LIBCPP_TYPE_VIS_ONLY multiset
Howard Hinnantbc8d3f92010-05-11 19:42:16809{
810public:
811 // types:
812 typedef _Key key_type;
813 typedef key_type value_type;
814 typedef _Compare key_compare;
815 typedef key_compare value_compare;
816 typedef _Allocator allocator_type;
817 typedef value_type& reference;
818 typedef const value_type& const_reference;
819
820private:
821 typedef __tree<value_type, value_compare, allocator_type> __base;
822 typedef allocator_traits<allocator_type> __alloc_traits;
823 typedef typename __base::__node_holder __node_holder;
824
825 __base __tree_;
826
827public:
828 typedef typename __base::pointer pointer;
829 typedef typename __base::const_pointer const_pointer;
830 typedef typename __base::size_type size_type;
831 typedef typename __base::difference_type difference_type;
832 typedef typename __base::const_iterator iterator;
833 typedef typename __base::const_iterator const_iterator;
Howard Hinnant0949eed2011-06-30 21:18:19834 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
835 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
Howard Hinnantbc8d3f92010-05-11 19:42:16836
837 // construct/copy/destroy:
Howard Hinnant28c97e62010-09-23 16:27:36838 _LIBCPP_INLINE_VISIBILITY
Marshall Clowcaaa1412014-03-10 04:50:10839 multiset()
840 _NOEXCEPT_(
841 is_nothrow_default_constructible<allocator_type>::value &&
842 is_nothrow_default_constructible<key_compare>::value &&
843 is_nothrow_copy_constructible<key_compare>::value)
844 : __tree_(value_compare()) {}
845
846 _LIBCPP_INLINE_VISIBILITY
847 explicit multiset(const value_compare& __comp)
Howard Hinnantb2e2a8f2011-06-04 15:22:34848 _NOEXCEPT_(
849 is_nothrow_default_constructible<allocator_type>::value &&
Howard Hinnantb2e2a8f2011-06-04 15:22:34850 is_nothrow_copy_constructible<key_compare>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16851 : __tree_(__comp) {}
Marshall Clowcaaa1412014-03-10 04:50:10852
Howard Hinnant28c97e62010-09-23 16:27:36853 _LIBCPP_INLINE_VISIBILITY
Marshall Clow48c74702014-03-05 19:06:20854 explicit multiset(const value_compare& __comp, const allocator_type& __a)
Howard Hinnantbc8d3f92010-05-11 19:42:16855 : __tree_(__comp, __a) {}
856 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36857 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16858 multiset(_InputIterator __f, _InputIterator __l,
859 const value_compare& __comp = value_compare())
860 : __tree_(__comp)
861 {
862 insert(__f, __l);
863 }
864
Marshall Clow24a7e332013-09-11 00:06:45865#if _LIBCPP_STD_VER > 11
866 template <class _InputIterator>
867 _LIBCPP_INLINE_VISIBILITY
868 multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
869 : multiset(__f, __l, key_compare(), __a) {}
870#endif
871
Howard Hinnantbc8d3f92010-05-11 19:42:16872 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:36873 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16874 multiset(_InputIterator __f, _InputIterator __l,
875 const value_compare& __comp, const allocator_type& __a)
876 : __tree_(__comp, __a)
877 {
878 insert(__f, __l);
879 }
880
Howard Hinnant28c97e62010-09-23 16:27:36881 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16882 multiset(const multiset& __s)
883 : __tree_(__s.__tree_.value_comp(),
884 __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
885 {
886 insert(__s.begin(), __s.end());
887 }
888
Howard Hinnant61aa6012011-07-01 19:24:36889 _LIBCPP_INLINE_VISIBILITY
890 multiset& operator=(const multiset& __s)
891 {
892 __tree_ = __s.__tree_;
893 return *this;
894 }
895
Howard Hinnant73d21a42010-09-04 23:28:19896#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36897 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16898 multiset(multiset&& __s)
Howard Hinnantb2e2a8f2011-06-04 15:22:34899 _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
Howard Hinnant0949eed2011-06-30 21:18:19900 : __tree_(_VSTD::move(__s.__tree_)) {}
Howard Hinnant73d21a42010-09-04 23:28:19901#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36902 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16903 explicit multiset(const allocator_type& __a)
904 : __tree_(__a) {}
Howard Hinnant28c97e62010-09-23 16:27:36905 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16906 multiset(const multiset& __s, const allocator_type& __a)
907 : __tree_(__s.__tree_.value_comp(), __a)
908 {
909 insert(__s.begin(), __s.end());
910 }
Howard Hinnant73d21a42010-09-04 23:28:19911#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16912 multiset(multiset&& __s, const allocator_type& __a);
913#endif
914
Howard Hinnante3e32912011-08-12 21:56:02915#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnant28c97e62010-09-23 16:27:36916 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16917 multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
918 : __tree_(__comp)
919 {
920 insert(__il.begin(), __il.end());
921 }
922
Howard Hinnant28c97e62010-09-23 16:27:36923 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16924 multiset(initializer_list<value_type> __il, const value_compare& __comp,
925 const allocator_type& __a)
926 : __tree_(__comp, __a)
927 {
928 insert(__il.begin(), __il.end());
929 }
930
Marshall Clow24a7e332013-09-11 00:06:45931#if _LIBCPP_STD_VER > 11
932 _LIBCPP_INLINE_VISIBILITY
933 multiset(initializer_list<value_type> __il, const allocator_type& __a)
934 : multiset(__il, key_compare(), __a) {}
935#endif
936
Howard Hinnant28c97e62010-09-23 16:27:36937 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16938 multiset& operator=(initializer_list<value_type> __il)
939 {
940 __tree_.__assign_multi(__il.begin(), __il.end());
941 return *this;
942 }
Howard Hinnante3e32912011-08-12 21:56:02943#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnantbc8d3f92010-05-11 19:42:16944
Howard Hinnant73d21a42010-09-04 23:28:19945#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:36946 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16947 multiset& operator=(multiset&& __s)
Howard Hinnantb2e2a8f2011-06-04 15:22:34948 _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16949 {
Howard Hinnant0949eed2011-06-30 21:18:19950 __tree_ = _VSTD::move(__s.__tree_);
Howard Hinnantbc8d3f92010-05-11 19:42:16951 return *this;
952 }
Howard Hinnant73d21a42010-09-04 23:28:19953#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16954
Howard Hinnant28c97e62010-09-23 16:27:36955 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34956 iterator begin() _NOEXCEPT {return __tree_.begin();}
Howard Hinnant28c97e62010-09-23 16:27:36957 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34958 const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
Howard Hinnant28c97e62010-09-23 16:27:36959 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34960 iterator end() _NOEXCEPT {return __tree_.end();}
Howard Hinnant28c97e62010-09-23 16:27:36961 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34962 const_iterator end() const _NOEXCEPT {return __tree_.end();}
Howard Hinnantbc8d3f92010-05-11 19:42:16963
Howard Hinnant28c97e62010-09-23 16:27:36964 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34965 reverse_iterator rbegin() _NOEXCEPT
966 {return reverse_iterator(end());}
Howard Hinnant28c97e62010-09-23 16:27:36967 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34968 const_reverse_iterator rbegin() const _NOEXCEPT
969 {return const_reverse_iterator(end());}
Howard Hinnant28c97e62010-09-23 16:27:36970 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34971 reverse_iterator rend() _NOEXCEPT
972 {return reverse_iterator(begin());}
Howard Hinnant28c97e62010-09-23 16:27:36973 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34974 const_reverse_iterator rend() const _NOEXCEPT
975 {return const_reverse_iterator(begin());}
Howard Hinnantbc8d3f92010-05-11 19:42:16976
Howard Hinnant28c97e62010-09-23 16:27:36977 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34978 const_iterator cbegin() const _NOEXCEPT {return begin();}
Howard Hinnant28c97e62010-09-23 16:27:36979 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34980 const_iterator cend() const _NOEXCEPT {return end();}
Howard Hinnant28c97e62010-09-23 16:27:36981 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34982 const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
Howard Hinnant28c97e62010-09-23 16:27:36983 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34984 const_reverse_iterator crend() const _NOEXCEPT {return rend();}
Howard Hinnantbc8d3f92010-05-11 19:42:16985
Howard Hinnant28c97e62010-09-23 16:27:36986 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34987 bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
Howard Hinnant28c97e62010-09-23 16:27:36988 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34989 size_type size() const _NOEXCEPT {return __tree_.size();}
Howard Hinnant28c97e62010-09-23 16:27:36990 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:34991 size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
Howard Hinnantbc8d3f92010-05-11 19:42:16992
993 // modifiers:
Howard Hinnant73d21a42010-09-04 23:28:19994#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnantbc8d3f92010-05-11 19:42:16995 template <class... _Args>
Howard Hinnant28c97e62010-09-23 16:27:36996 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16997 iterator emplace(_Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:19998 {return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
Howard Hinnantbc8d3f92010-05-11 19:42:16999 template <class... _Args>
Howard Hinnant28c97e62010-09-23 16:27:361000 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161001 iterator emplace_hint(const_iterator __p, _Args&&... __args)
Howard Hinnant0949eed2011-06-30 21:18:191002 {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
Howard Hinnant73d21a42010-09-04 23:28:191003#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
Howard Hinnant28c97e62010-09-23 16:27:361004 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161005 iterator insert(const value_type& __v)
1006 {return __tree_.__insert_multi(__v);}
Howard Hinnant73d21a42010-09-04 23:28:191007#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:361008 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161009 iterator insert(value_type&& __v)
Howard Hinnant0949eed2011-06-30 21:18:191010 {return __tree_.__insert_multi(_VSTD::move(__v));}
Howard Hinnant73d21a42010-09-04 23:28:191011#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:361012 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161013 iterator insert(const_iterator __p, const value_type& __v)
1014 {return __tree_.__insert_multi(__p, __v);}
Howard Hinnant73d21a42010-09-04 23:28:191015#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant28c97e62010-09-23 16:27:361016 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161017 iterator insert(const_iterator __p, value_type&& __v)
Howard Hinnant0949eed2011-06-30 21:18:191018 {return __tree_.__insert_multi(_VSTD::move(__v));}
Howard Hinnant73d21a42010-09-04 23:28:191019#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:161020 template <class _InputIterator>
Howard Hinnant28c97e62010-09-23 16:27:361021 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161022 void insert(_InputIterator __f, _InputIterator __l)
1023 {
1024 for (const_iterator __e = cend(); __f != __l; ++__f)
1025 __tree_.__insert_multi(__e, *__f);
1026 }
1027
Howard Hinnante3e32912011-08-12 21:56:021028#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnant28c97e62010-09-23 16:27:361029 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161030 void insert(initializer_list<value_type> __il)
1031 {insert(__il.begin(), __il.end());}
Howard Hinnante3e32912011-08-12 21:56:021032#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
Howard Hinnantbc8d3f92010-05-11 19:42:161033
Howard Hinnant28c97e62010-09-23 16:27:361034 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161035 iterator erase(const_iterator __p) {return __tree_.erase(__p);}
Howard Hinnant28c97e62010-09-23 16:27:361036 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161037 size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
Howard Hinnant28c97e62010-09-23 16:27:361038 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161039 iterator erase(const_iterator __f, const_iterator __l)
1040 {return __tree_.erase(__f, __l);}
Howard Hinnant28c97e62010-09-23 16:27:361041 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:341042 void clear() _NOEXCEPT {__tree_.clear();}
Howard Hinnantbc8d3f92010-05-11 19:42:161043
Howard Hinnant28c97e62010-09-23 16:27:361044 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:341045 void swap(multiset& __s)
1046 _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
1047 {__tree_.swap(__s.__tree_);}
Howard Hinnantbc8d3f92010-05-11 19:42:161048
Howard Hinnant28c97e62010-09-23 16:27:361049 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb2e2a8f2011-06-04 15:22:341050 allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
Howard Hinnant28c97e62010-09-23 16:27:361051 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161052 key_compare key_comp() const {return __tree_.value_comp();}
Howard Hinnant28c97e62010-09-23 16:27:361053 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161054 value_compare value_comp() const {return __tree_.value_comp();}
1055
1056 // set operations:
Howard Hinnant28c97e62010-09-23 16:27:361057 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161058 iterator find(const key_type& __k) {return __tree_.find(__k);}
Howard Hinnant28c97e62010-09-23 16:27:361059 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161060 const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
Marshall Clow4a0a9812013-08-13 01:11:061061#if _LIBCPP_STD_VER > 11
1062 template <typename _K2>
1063 _LIBCPP_INLINE_VISIBILITY
1064 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
1065 find(const _K2& __k) {return __tree_.find(__k);}
1066 template <typename _K2>
1067 _LIBCPP_INLINE_VISIBILITY
1068 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
1069 find(const _K2& __k) const {return __tree_.find(__k);}
1070#endif
1071
Howard Hinnant28c97e62010-09-23 16:27:361072 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161073 size_type count(const key_type& __k) const
1074 {return __tree_.__count_multi(__k);}
Marshall Clow4de32042014-08-24 23:54:161075#if _LIBCPP_STD_VER > 11
1076 template <typename _K2>
1077 _LIBCPP_INLINE_VISIBILITY
1078 typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
1079 count(const _K2& __k) {return __tree_.__count_multi(__k);}
1080#endif
Marshall Clow4a0a9812013-08-13 01:11:061081
Howard Hinnant28c97e62010-09-23 16:27:361082 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161083 iterator lower_bound(const key_type& __k)
1084 {return __tree_.lower_bound(__k);}
Howard Hinnant28c97e62010-09-23 16:27:361085 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161086 const_iterator lower_bound(const key_type& __k) const
1087 {return __tree_.lower_bound(__k);}
Marshall Clow4a0a9812013-08-13 01:11:061088#if _LIBCPP_STD_VER > 11
1089 template <typename _K2>
1090 _LIBCPP_INLINE_VISIBILITY
1091 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
1092 lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
1093
1094 template <typename _K2>
1095 _LIBCPP_INLINE_VISIBILITY
1096 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
1097 lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
1098#endif
1099
Howard Hinnant28c97e62010-09-23 16:27:361100 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161101 iterator upper_bound(const key_type& __k)
1102 {return __tree_.upper_bound(__k);}
Howard Hinnant28c97e62010-09-23 16:27:361103 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161104 const_iterator upper_bound(const key_type& __k) const
1105 {return __tree_.upper_bound(__k);}
Marshall Clow4a0a9812013-08-13 01:11:061106#if _LIBCPP_STD_VER > 11
1107 template <typename _K2>
1108 _LIBCPP_INLINE_VISIBILITY
1109 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
1110 upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
1111 template <typename _K2>
1112 _LIBCPP_INLINE_VISIBILITY
1113 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
1114 upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
1115#endif
1116
Howard Hinnant28c97e62010-09-23 16:27:361117 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161118 pair<iterator,iterator> equal_range(const key_type& __k)
1119 {return __tree_.__equal_range_multi(__k);}
Howard Hinnant28c97e62010-09-23 16:27:361120 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161121 pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
1122 {return __tree_.__equal_range_multi(__k);}
Marshall Clow4a0a9812013-08-13 01:11:061123#if _LIBCPP_STD_VER > 11
1124 template <typename _K2>
1125 _LIBCPP_INLINE_VISIBILITY
1126 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
1127 equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
1128 template <typename _K2>
1129 _LIBCPP_INLINE_VISIBILITY
1130 typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
1131 equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
1132#endif
Howard Hinnantbc8d3f92010-05-11 19:42:161133};
1134
Howard Hinnant73d21a42010-09-04 23:28:191135#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:161136
1137template <class _Key, class _Compare, class _Allocator>
1138multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
Howard Hinnant0949eed2011-06-30 21:18:191139 : __tree_(_VSTD::move(__s.__tree_), __a)
Howard Hinnantbc8d3f92010-05-11 19:42:161140{
1141 if (__a != __s.get_allocator())
1142 {
1143 const_iterator __e = cend();
1144 while (!__s.empty())
Howard Hinnant0949eed2011-06-30 21:18:191145 insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
Howard Hinnantbc8d3f92010-05-11 19:42:161146 }
1147}
1148
Howard Hinnant73d21a42010-09-04 23:28:191149#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:161150
1151template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361152inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161153bool
1154operator==(const multiset<_Key, _Compare, _Allocator>& __x,
1155 const multiset<_Key, _Compare, _Allocator>& __y)
1156{
Howard Hinnant0949eed2011-06-30 21:18:191157 return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
Howard Hinnantbc8d3f92010-05-11 19:42:161158}
1159
1160template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361161inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161162bool
1163operator< (const multiset<_Key, _Compare, _Allocator>& __x,
1164 const multiset<_Key, _Compare, _Allocator>& __y)
1165{
Howard Hinnant0949eed2011-06-30 21:18:191166 return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
Howard Hinnantbc8d3f92010-05-11 19:42:161167}
1168
1169template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361170inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161171bool
1172operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
1173 const multiset<_Key, _Compare, _Allocator>& __y)
1174{
1175 return !(__x == __y);
1176}
1177
1178template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361179inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161180bool
1181operator> (const multiset<_Key, _Compare, _Allocator>& __x,
1182 const multiset<_Key, _Compare, _Allocator>& __y)
1183{
1184 return __y < __x;
1185}
1186
1187template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361188inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161189bool
1190operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
1191 const multiset<_Key, _Compare, _Allocator>& __y)
1192{
1193 return !(__x < __y);
1194}
1195
1196template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361197inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161198bool
1199operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
1200 const multiset<_Key, _Compare, _Allocator>& __y)
1201{
1202 return !(__y < __x);
1203}
1204
1205template <class _Key, class _Compare, class _Allocator>
Howard Hinnant28c97e62010-09-23 16:27:361206inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161207void
1208swap(multiset<_Key, _Compare, _Allocator>& __x,
1209 multiset<_Key, _Compare, _Allocator>& __y)
Howard Hinnantb2e2a8f2011-06-04 15:22:341210 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
Howard Hinnantbc8d3f92010-05-11 19:42:161211{
1212 __x.swap(__y);
1213}
1214
Howard Hinnantbc8d3f92010-05-11 19:42:161215_LIBCPP_END_NAMESPACE_STD
1216
1217#endif // _LIBCPP_SET