xref: /aosp_15_r20/external/libcxx/include/set (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1*58b9f456SAndroid Build Coastguard Worker// -*- C++ -*-
2*58b9f456SAndroid Build Coastguard Worker//===---------------------------- set -------------------------------------===//
3*58b9f456SAndroid Build Coastguard Worker//
4*58b9f456SAndroid Build Coastguard Worker//                     The LLVM Compiler Infrastructure
5*58b9f456SAndroid Build Coastguard Worker//
6*58b9f456SAndroid Build Coastguard Worker// This file is dual licensed under the MIT and the University of Illinois Open
7*58b9f456SAndroid Build Coastguard Worker// Source Licenses. See LICENSE.TXT for details.
8*58b9f456SAndroid Build Coastguard Worker//
9*58b9f456SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
10*58b9f456SAndroid Build Coastguard Worker
11*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_SET
12*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_SET
13*58b9f456SAndroid Build Coastguard Worker
14*58b9f456SAndroid Build Coastguard Worker/*
15*58b9f456SAndroid Build Coastguard Worker
16*58b9f456SAndroid Build Coastguard Worker    set synopsis
17*58b9f456SAndroid Build Coastguard Worker
18*58b9f456SAndroid Build Coastguard Workernamespace std
19*58b9f456SAndroid Build Coastguard Worker{
20*58b9f456SAndroid Build Coastguard Worker
21*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare = less<Key>,
22*58b9f456SAndroid Build Coastguard Worker          class Allocator = allocator<Key>>
23*58b9f456SAndroid Build Coastguard Workerclass set
24*58b9f456SAndroid Build Coastguard Worker{
25*58b9f456SAndroid Build Coastguard Workerpublic:
26*58b9f456SAndroid Build Coastguard Worker    // types:
27*58b9f456SAndroid Build Coastguard Worker    typedef Key                                      key_type;
28*58b9f456SAndroid Build Coastguard Worker    typedef key_type                                 value_type;
29*58b9f456SAndroid Build Coastguard Worker    typedef Compare                                  key_compare;
30*58b9f456SAndroid Build Coastguard Worker    typedef key_compare                              value_compare;
31*58b9f456SAndroid Build Coastguard Worker    typedef Allocator                                allocator_type;
32*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::reference       reference;
33*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::const_reference const_reference;
34*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::size_type       size_type;
35*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::difference_type difference_type;
36*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::pointer         pointer;
37*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::const_pointer   const_pointer;
38*58b9f456SAndroid Build Coastguard Worker
39*58b9f456SAndroid Build Coastguard Worker    typedef implementation-defined                   iterator;
40*58b9f456SAndroid Build Coastguard Worker    typedef implementation-defined                   const_iterator;
41*58b9f456SAndroid Build Coastguard Worker    typedef std::reverse_iterator<iterator>          reverse_iterator;
42*58b9f456SAndroid Build Coastguard Worker    typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
43*58b9f456SAndroid Build Coastguard Worker    typedef unspecified                              node_type;               // C++17
44*58b9f456SAndroid Build Coastguard Worker    typedef INSERT_RETURN_TYPE<iterator, node_type>  insert_return_type;      // C++17
45*58b9f456SAndroid Build Coastguard Worker
46*58b9f456SAndroid Build Coastguard Worker    // construct/copy/destroy:
47*58b9f456SAndroid Build Coastguard Worker    set()
48*58b9f456SAndroid Build Coastguard Worker        noexcept(
49*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
50*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<key_compare>::value &&
51*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value);
52*58b9f456SAndroid Build Coastguard Worker    explicit set(const value_compare& comp);
53*58b9f456SAndroid Build Coastguard Worker    set(const value_compare& comp, const allocator_type& a);
54*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
55*58b9f456SAndroid Build Coastguard Worker        set(InputIterator first, InputIterator last,
56*58b9f456SAndroid Build Coastguard Worker            const value_compare& comp = value_compare());
57*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
58*58b9f456SAndroid Build Coastguard Worker        set(InputIterator first, InputIterator last, const value_compare& comp,
59*58b9f456SAndroid Build Coastguard Worker            const allocator_type& a);
60*58b9f456SAndroid Build Coastguard Worker    set(const set& s);
61*58b9f456SAndroid Build Coastguard Worker    set(set&& s)
62*58b9f456SAndroid Build Coastguard Worker        noexcept(
63*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_constructible<allocator_type>::value &&
64*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_constructible<key_compare>::value);
65*58b9f456SAndroid Build Coastguard Worker    explicit set(const allocator_type& a);
66*58b9f456SAndroid Build Coastguard Worker    set(const set& s, const allocator_type& a);
67*58b9f456SAndroid Build Coastguard Worker    set(set&& s, const allocator_type& a);
68*58b9f456SAndroid Build Coastguard Worker    set(initializer_list<value_type> il, const value_compare& comp = value_compare());
69*58b9f456SAndroid Build Coastguard Worker    set(initializer_list<value_type> il, const value_compare& comp,
70*58b9f456SAndroid Build Coastguard Worker        const allocator_type& a);
71*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
72*58b9f456SAndroid Build Coastguard Worker        set(InputIterator first, InputIterator last, const allocator_type& a)
73*58b9f456SAndroid Build Coastguard Worker            : set(first, last, Compare(), a) {}  // C++14
74*58b9f456SAndroid Build Coastguard Worker    set(initializer_list<value_type> il, const allocator_type& a)
75*58b9f456SAndroid Build Coastguard Worker        : set(il, Compare(), a) {}  // C++14
76*58b9f456SAndroid Build Coastguard Worker    ~set();
77*58b9f456SAndroid Build Coastguard Worker
78*58b9f456SAndroid Build Coastguard Worker    set& operator=(const set& s);
79*58b9f456SAndroid Build Coastguard Worker    set& operator=(set&& s)
80*58b9f456SAndroid Build Coastguard Worker        noexcept(
81*58b9f456SAndroid Build Coastguard Worker            allocator_type::propagate_on_container_move_assignment::value &&
82*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_assignable<allocator_type>::value &&
83*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_assignable<key_compare>::value);
84*58b9f456SAndroid Build Coastguard Worker    set& operator=(initializer_list<value_type> il);
85*58b9f456SAndroid Build Coastguard Worker
86*58b9f456SAndroid Build Coastguard Worker    // iterators:
87*58b9f456SAndroid Build Coastguard Worker          iterator begin() noexcept;
88*58b9f456SAndroid Build Coastguard Worker    const_iterator begin() const noexcept;
89*58b9f456SAndroid Build Coastguard Worker          iterator end() noexcept;
90*58b9f456SAndroid Build Coastguard Worker    const_iterator end()   const noexcept;
91*58b9f456SAndroid Build Coastguard Worker
92*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rbegin() noexcept;
93*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rbegin() const noexcept;
94*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rend() noexcept;
95*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rend()   const noexcept;
96*58b9f456SAndroid Build Coastguard Worker
97*58b9f456SAndroid Build Coastguard Worker    const_iterator         cbegin()  const noexcept;
98*58b9f456SAndroid Build Coastguard Worker    const_iterator         cend()    const noexcept;
99*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crbegin() const noexcept;
100*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crend()   const noexcept;
101*58b9f456SAndroid Build Coastguard Worker
102*58b9f456SAndroid Build Coastguard Worker    // capacity:
103*58b9f456SAndroid Build Coastguard Worker    bool      empty()    const noexcept;
104*58b9f456SAndroid Build Coastguard Worker    size_type size()     const noexcept;
105*58b9f456SAndroid Build Coastguard Worker    size_type max_size() const noexcept;
106*58b9f456SAndroid Build Coastguard Worker
107*58b9f456SAndroid Build Coastguard Worker    // modifiers:
108*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
109*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> emplace(Args&&... args);
110*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
111*58b9f456SAndroid Build Coastguard Worker        iterator emplace_hint(const_iterator position, Args&&... args);
112*58b9f456SAndroid Build Coastguard Worker    pair<iterator,bool> insert(const value_type& v);
113*58b9f456SAndroid Build Coastguard Worker    pair<iterator,bool> insert(value_type&& v);
114*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator position, const value_type& v);
115*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator position, value_type&& v);
116*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
117*58b9f456SAndroid Build Coastguard Worker        void insert(InputIterator first, InputIterator last);
118*58b9f456SAndroid Build Coastguard Worker    void insert(initializer_list<value_type> il);
119*58b9f456SAndroid Build Coastguard Worker
120*58b9f456SAndroid Build Coastguard Worker    node_type extract(const_iterator position);                                       // C++17
121*58b9f456SAndroid Build Coastguard Worker    node_type extract(const key_type& x);                                             // C++17
122*58b9f456SAndroid Build Coastguard Worker    insert_return_type insert(node_type&& nh);                                        // C++17
123*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator hint, node_type&& nh);                             // C++17
124*58b9f456SAndroid Build Coastguard Worker
125*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator position);
126*58b9f456SAndroid Build Coastguard Worker    iterator  erase(iterator position);  // C++14
127*58b9f456SAndroid Build Coastguard Worker    size_type erase(const key_type& k);
128*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator first, const_iterator last);
129*58b9f456SAndroid Build Coastguard Worker    void clear() noexcept;
130*58b9f456SAndroid Build Coastguard Worker
131*58b9f456SAndroid Build Coastguard Worker    template<class C2>
132*58b9f456SAndroid Build Coastguard Worker      void merge(set<Key, C2, Allocator>& source);         // C++17
133*58b9f456SAndroid Build Coastguard Worker    template<class C2>
134*58b9f456SAndroid Build Coastguard Worker      void merge(set<Key, C2, Allocator>&& source);        // C++17
135*58b9f456SAndroid Build Coastguard Worker    template<class C2>
136*58b9f456SAndroid Build Coastguard Worker      void merge(multiset<Key, C2, Allocator>& source);    // C++17
137*58b9f456SAndroid Build Coastguard Worker    template<class C2>
138*58b9f456SAndroid Build Coastguard Worker      void merge(multiset<Key, C2, Allocator>&& source);   // C++17
139*58b9f456SAndroid Build Coastguard Worker
140*58b9f456SAndroid Build Coastguard Worker    void swap(set& s)
141*58b9f456SAndroid Build Coastguard Worker        noexcept(
142*58b9f456SAndroid Build Coastguard Worker            __is_nothrow_swappable<key_compare>::value &&
143*58b9f456SAndroid Build Coastguard Worker            (!allocator_type::propagate_on_container_swap::value ||
144*58b9f456SAndroid Build Coastguard Worker             __is_nothrow_swappable<allocator_type>::value));
145*58b9f456SAndroid Build Coastguard Worker
146*58b9f456SAndroid Build Coastguard Worker    // observers:
147*58b9f456SAndroid Build Coastguard Worker    allocator_type get_allocator() const noexcept;
148*58b9f456SAndroid Build Coastguard Worker    key_compare    key_comp()      const;
149*58b9f456SAndroid Build Coastguard Worker    value_compare  value_comp()    const;
150*58b9f456SAndroid Build Coastguard Worker
151*58b9f456SAndroid Build Coastguard Worker    // set operations:
152*58b9f456SAndroid Build Coastguard Worker          iterator find(const key_type& k);
153*58b9f456SAndroid Build Coastguard Worker    const_iterator find(const key_type& k) const;
154*58b9f456SAndroid Build Coastguard Worker    template<typename K>
155*58b9f456SAndroid Build Coastguard Worker        iterator find(const K& x);
156*58b9f456SAndroid Build Coastguard Worker    template<typename K>
157*58b9f456SAndroid Build Coastguard Worker        const_iterator find(const K& x) const;  // C++14
158*58b9f456SAndroid Build Coastguard Worker    template<typename K>
159*58b9f456SAndroid Build Coastguard Worker      size_type count(const K& x) const;        // C++14
160*58b9f456SAndroid Build Coastguard Worker
161*58b9f456SAndroid Build Coastguard Worker    size_type      count(const key_type& k) const;
162*58b9f456SAndroid Build Coastguard Worker          iterator lower_bound(const key_type& k);
163*58b9f456SAndroid Build Coastguard Worker    const_iterator lower_bound(const key_type& k) const;
164*58b9f456SAndroid Build Coastguard Worker    template<typename K>
165*58b9f456SAndroid Build Coastguard Worker        iterator lower_bound(const K& x);              // C++14
166*58b9f456SAndroid Build Coastguard Worker    template<typename K>
167*58b9f456SAndroid Build Coastguard Worker        const_iterator lower_bound(const K& x) const;  // C++14
168*58b9f456SAndroid Build Coastguard Worker
169*58b9f456SAndroid Build Coastguard Worker          iterator upper_bound(const key_type& k);
170*58b9f456SAndroid Build Coastguard Worker    const_iterator upper_bound(const key_type& k) const;
171*58b9f456SAndroid Build Coastguard Worker    template<typename K>
172*58b9f456SAndroid Build Coastguard Worker        iterator upper_bound(const K& x);              // C++14
173*58b9f456SAndroid Build Coastguard Worker    template<typename K>
174*58b9f456SAndroid Build Coastguard Worker        const_iterator upper_bound(const K& x) const;  // C++14
175*58b9f456SAndroid Build Coastguard Worker    pair<iterator,iterator>             equal_range(const key_type& k);
176*58b9f456SAndroid Build Coastguard Worker    pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
177*58b9f456SAndroid Build Coastguard Worker    template<typename K>
178*58b9f456SAndroid Build Coastguard Worker        pair<iterator,iterator>             equal_range(const K& x);        // C++14
179*58b9f456SAndroid Build Coastguard Worker    template<typename K>
180*58b9f456SAndroid Build Coastguard Worker        pair<const_iterator,const_iterator> equal_range(const K& x) const;  // C++14
181*58b9f456SAndroid Build Coastguard Worker};
182*58b9f456SAndroid Build Coastguard Worker
183*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
184*58b9f456SAndroid Build Coastguard Workerbool
185*58b9f456SAndroid Build Coastguard Workeroperator==(const set<Key, Compare, Allocator>& x,
186*58b9f456SAndroid Build Coastguard Worker           const set<Key, Compare, Allocator>& y);
187*58b9f456SAndroid Build Coastguard Worker
188*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
189*58b9f456SAndroid Build Coastguard Workerbool
190*58b9f456SAndroid Build Coastguard Workeroperator< (const set<Key, Compare, Allocator>& x,
191*58b9f456SAndroid Build Coastguard Worker           const set<Key, Compare, Allocator>& y);
192*58b9f456SAndroid Build Coastguard Worker
193*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
194*58b9f456SAndroid Build Coastguard Workerbool
195*58b9f456SAndroid Build Coastguard Workeroperator!=(const set<Key, Compare, Allocator>& x,
196*58b9f456SAndroid Build Coastguard Worker           const set<Key, Compare, Allocator>& y);
197*58b9f456SAndroid Build Coastguard Worker
198*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
199*58b9f456SAndroid Build Coastguard Workerbool
200*58b9f456SAndroid Build Coastguard Workeroperator> (const set<Key, Compare, Allocator>& x,
201*58b9f456SAndroid Build Coastguard Worker           const set<Key, Compare, Allocator>& y);
202*58b9f456SAndroid Build Coastguard Worker
203*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
204*58b9f456SAndroid Build Coastguard Workerbool
205*58b9f456SAndroid Build Coastguard Workeroperator>=(const set<Key, Compare, Allocator>& x,
206*58b9f456SAndroid Build Coastguard Worker           const set<Key, Compare, Allocator>& y);
207*58b9f456SAndroid Build Coastguard Worker
208*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
209*58b9f456SAndroid Build Coastguard Workerbool
210*58b9f456SAndroid Build Coastguard Workeroperator<=(const set<Key, Compare, Allocator>& x,
211*58b9f456SAndroid Build Coastguard Worker           const set<Key, Compare, Allocator>& y);
212*58b9f456SAndroid Build Coastguard Worker
213*58b9f456SAndroid Build Coastguard Worker// specialized algorithms:
214*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
215*58b9f456SAndroid Build Coastguard Workervoid
216*58b9f456SAndroid Build Coastguard Workerswap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y)
217*58b9f456SAndroid Build Coastguard Worker    noexcept(noexcept(x.swap(y)));
218*58b9f456SAndroid Build Coastguard Worker
219*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator, class Predicate>
220*58b9f456SAndroid Build Coastguard Worker  void erase_if(set<Key, Compare, Allocator>& c, Predicate pred);  // C++20
221*58b9f456SAndroid Build Coastguard Worker
222*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare = less<Key>,
223*58b9f456SAndroid Build Coastguard Worker          class Allocator = allocator<Key>>
224*58b9f456SAndroid Build Coastguard Workerclass multiset
225*58b9f456SAndroid Build Coastguard Worker{
226*58b9f456SAndroid Build Coastguard Workerpublic:
227*58b9f456SAndroid Build Coastguard Worker    // types:
228*58b9f456SAndroid Build Coastguard Worker    typedef Key                                      key_type;
229*58b9f456SAndroid Build Coastguard Worker    typedef key_type                                 value_type;
230*58b9f456SAndroid Build Coastguard Worker    typedef Compare                                  key_compare;
231*58b9f456SAndroid Build Coastguard Worker    typedef key_compare                              value_compare;
232*58b9f456SAndroid Build Coastguard Worker    typedef Allocator                                allocator_type;
233*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::reference       reference;
234*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::const_reference const_reference;
235*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::size_type       size_type;
236*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::difference_type difference_type;
237*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::pointer         pointer;
238*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::const_pointer   const_pointer;
239*58b9f456SAndroid Build Coastguard Worker
240*58b9f456SAndroid Build Coastguard Worker    typedef implementation-defined                   iterator;
241*58b9f456SAndroid Build Coastguard Worker    typedef implementation-defined                   const_iterator;
242*58b9f456SAndroid Build Coastguard Worker    typedef std::reverse_iterator<iterator>          reverse_iterator;
243*58b9f456SAndroid Build Coastguard Worker    typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
244*58b9f456SAndroid Build Coastguard Worker    typedef unspecified                              node_type;               // C++17
245*58b9f456SAndroid Build Coastguard Worker
246*58b9f456SAndroid Build Coastguard Worker    // construct/copy/destroy:
247*58b9f456SAndroid Build Coastguard Worker    multiset()
248*58b9f456SAndroid Build Coastguard Worker        noexcept(
249*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
250*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<key_compare>::value &&
251*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value);
252*58b9f456SAndroid Build Coastguard Worker    explicit multiset(const value_compare& comp);
253*58b9f456SAndroid Build Coastguard Worker    multiset(const value_compare& comp, const allocator_type& a);
254*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
255*58b9f456SAndroid Build Coastguard Worker        multiset(InputIterator first, InputIterator last,
256*58b9f456SAndroid Build Coastguard Worker                 const value_compare& comp = value_compare());
257*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
258*58b9f456SAndroid Build Coastguard Worker        multiset(InputIterator first, InputIterator last,
259*58b9f456SAndroid Build Coastguard Worker                 const value_compare& comp, const allocator_type& a);
260*58b9f456SAndroid Build Coastguard Worker    multiset(const multiset& s);
261*58b9f456SAndroid Build Coastguard Worker    multiset(multiset&& s)
262*58b9f456SAndroid Build Coastguard Worker        noexcept(
263*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_constructible<allocator_type>::value &&
264*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_constructible<key_compare>::value);
265*58b9f456SAndroid Build Coastguard Worker    explicit multiset(const allocator_type& a);
266*58b9f456SAndroid Build Coastguard Worker    multiset(const multiset& s, const allocator_type& a);
267*58b9f456SAndroid Build Coastguard Worker    multiset(multiset&& s, const allocator_type& a);
268*58b9f456SAndroid Build Coastguard Worker    multiset(initializer_list<value_type> il, const value_compare& comp = value_compare());
269*58b9f456SAndroid Build Coastguard Worker    multiset(initializer_list<value_type> il, const value_compare& comp,
270*58b9f456SAndroid Build Coastguard Worker             const allocator_type& a);
271*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
272*58b9f456SAndroid Build Coastguard Worker        multiset(InputIterator first, InputIterator last, const allocator_type& a)
273*58b9f456SAndroid Build Coastguard Worker            : set(first, last, Compare(), a) {}  // C++14
274*58b9f456SAndroid Build Coastguard Worker    multiset(initializer_list<value_type> il, const allocator_type& a)
275*58b9f456SAndroid Build Coastguard Worker        : set(il, Compare(), a) {}  // C++14
276*58b9f456SAndroid Build Coastguard Worker    ~multiset();
277*58b9f456SAndroid Build Coastguard Worker
278*58b9f456SAndroid Build Coastguard Worker    multiset& operator=(const multiset& s);
279*58b9f456SAndroid Build Coastguard Worker    multiset& operator=(multiset&& s)
280*58b9f456SAndroid Build Coastguard Worker        noexcept(
281*58b9f456SAndroid Build Coastguard Worker            allocator_type::propagate_on_container_move_assignment::value &&
282*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_assignable<allocator_type>::value &&
283*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_assignable<key_compare>::value);
284*58b9f456SAndroid Build Coastguard Worker    multiset& operator=(initializer_list<value_type> il);
285*58b9f456SAndroid Build Coastguard Worker
286*58b9f456SAndroid Build Coastguard Worker    // iterators:
287*58b9f456SAndroid Build Coastguard Worker          iterator begin() noexcept;
288*58b9f456SAndroid Build Coastguard Worker    const_iterator begin() const noexcept;
289*58b9f456SAndroid Build Coastguard Worker          iterator end() noexcept;
290*58b9f456SAndroid Build Coastguard Worker    const_iterator end()   const noexcept;
291*58b9f456SAndroid Build Coastguard Worker
292*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rbegin() noexcept;
293*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rbegin() const noexcept;
294*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rend() noexcept;
295*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rend()   const noexcept;
296*58b9f456SAndroid Build Coastguard Worker
297*58b9f456SAndroid Build Coastguard Worker    const_iterator         cbegin()  const noexcept;
298*58b9f456SAndroid Build Coastguard Worker    const_iterator         cend()    const noexcept;
299*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crbegin() const noexcept;
300*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crend()   const noexcept;
301*58b9f456SAndroid Build Coastguard Worker
302*58b9f456SAndroid Build Coastguard Worker    // capacity:
303*58b9f456SAndroid Build Coastguard Worker    bool      empty()    const noexcept;
304*58b9f456SAndroid Build Coastguard Worker    size_type size()     const noexcept;
305*58b9f456SAndroid Build Coastguard Worker    size_type max_size() const noexcept;
306*58b9f456SAndroid Build Coastguard Worker
307*58b9f456SAndroid Build Coastguard Worker    // modifiers:
308*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
309*58b9f456SAndroid Build Coastguard Worker        iterator emplace(Args&&... args);
310*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
311*58b9f456SAndroid Build Coastguard Worker        iterator emplace_hint(const_iterator position, Args&&... args);
312*58b9f456SAndroid Build Coastguard Worker    iterator insert(const value_type& v);
313*58b9f456SAndroid Build Coastguard Worker    iterator insert(value_type&& v);
314*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator position, const value_type& v);
315*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator position, value_type&& v);
316*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
317*58b9f456SAndroid Build Coastguard Worker        void insert(InputIterator first, InputIterator last);
318*58b9f456SAndroid Build Coastguard Worker    void insert(initializer_list<value_type> il);
319*58b9f456SAndroid Build Coastguard Worker
320*58b9f456SAndroid Build Coastguard Worker    node_type extract(const_iterator position);                                       // C++17
321*58b9f456SAndroid Build Coastguard Worker    node_type extract(const key_type& x);                                             // C++17
322*58b9f456SAndroid Build Coastguard Worker    iterator insert(node_type&& nh);                                                  // C++17
323*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator hint, node_type&& nh);                             // C++17
324*58b9f456SAndroid Build Coastguard Worker
325*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator position);
326*58b9f456SAndroid Build Coastguard Worker    iterator  erase(iterator position);  // C++14
327*58b9f456SAndroid Build Coastguard Worker    size_type erase(const key_type& k);
328*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator first, const_iterator last);
329*58b9f456SAndroid Build Coastguard Worker    void clear() noexcept;
330*58b9f456SAndroid Build Coastguard Worker
331*58b9f456SAndroid Build Coastguard Worker    template<class C2>
332*58b9f456SAndroid Build Coastguard Worker      void merge(multiset<Key, C2, Allocator>& source);    // C++17
333*58b9f456SAndroid Build Coastguard Worker    template<class C2>
334*58b9f456SAndroid Build Coastguard Worker      void merge(multiset<Key, C2, Allocator>&& source);   // C++17
335*58b9f456SAndroid Build Coastguard Worker    template<class C2>
336*58b9f456SAndroid Build Coastguard Worker      void merge(set<Key, C2, Allocator>& source);         // C++17
337*58b9f456SAndroid Build Coastguard Worker    template<class C2>
338*58b9f456SAndroid Build Coastguard Worker      void merge(set<Key, C2, Allocator>&& source);        // C++17
339*58b9f456SAndroid Build Coastguard Worker
340*58b9f456SAndroid Build Coastguard Worker    void swap(multiset& s)
341*58b9f456SAndroid Build Coastguard Worker        noexcept(
342*58b9f456SAndroid Build Coastguard Worker            __is_nothrow_swappable<key_compare>::value &&
343*58b9f456SAndroid Build Coastguard Worker            (!allocator_type::propagate_on_container_swap::value ||
344*58b9f456SAndroid Build Coastguard Worker             __is_nothrow_swappable<allocator_type>::value));
345*58b9f456SAndroid Build Coastguard Worker
346*58b9f456SAndroid Build Coastguard Worker    // observers:
347*58b9f456SAndroid Build Coastguard Worker    allocator_type get_allocator() const noexcept;
348*58b9f456SAndroid Build Coastguard Worker    key_compare    key_comp()      const;
349*58b9f456SAndroid Build Coastguard Worker    value_compare  value_comp()    const;
350*58b9f456SAndroid Build Coastguard Worker
351*58b9f456SAndroid Build Coastguard Worker    // set operations:
352*58b9f456SAndroid Build Coastguard Worker          iterator find(const key_type& k);
353*58b9f456SAndroid Build Coastguard Worker    const_iterator find(const key_type& k) const;
354*58b9f456SAndroid Build Coastguard Worker    template<typename K>
355*58b9f456SAndroid Build Coastguard Worker        iterator find(const K& x);
356*58b9f456SAndroid Build Coastguard Worker    template<typename K>
357*58b9f456SAndroid Build Coastguard Worker        const_iterator find(const K& x) const;  // C++14
358*58b9f456SAndroid Build Coastguard Worker
359*58b9f456SAndroid Build Coastguard Worker    size_type      count(const key_type& k) const;
360*58b9f456SAndroid Build Coastguard Worker          iterator lower_bound(const key_type& k);
361*58b9f456SAndroid Build Coastguard Worker    const_iterator lower_bound(const key_type& k) const;
362*58b9f456SAndroid Build Coastguard Worker    template<typename K>
363*58b9f456SAndroid Build Coastguard Worker        iterator lower_bound(const K& x);              // C++14
364*58b9f456SAndroid Build Coastguard Worker    template<typename K>
365*58b9f456SAndroid Build Coastguard Worker        const_iterator lower_bound(const K& x) const;  // C++14
366*58b9f456SAndroid Build Coastguard Worker
367*58b9f456SAndroid Build Coastguard Worker          iterator upper_bound(const key_type& k);
368*58b9f456SAndroid Build Coastguard Worker    const_iterator upper_bound(const key_type& k) const;
369*58b9f456SAndroid Build Coastguard Worker    template<typename K>
370*58b9f456SAndroid Build Coastguard Worker        iterator upper_bound(const K& x);              // C++14
371*58b9f456SAndroid Build Coastguard Worker    template<typename K>
372*58b9f456SAndroid Build Coastguard Worker        const_iterator upper_bound(const K& x) const;  // C++14
373*58b9f456SAndroid Build Coastguard Worker
374*58b9f456SAndroid Build Coastguard Worker    pair<iterator,iterator>             equal_range(const key_type& k);
375*58b9f456SAndroid Build Coastguard Worker    pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
376*58b9f456SAndroid Build Coastguard Worker    template<typename K>
377*58b9f456SAndroid Build Coastguard Worker        pair<iterator,iterator>             equal_range(const K& x);        // C++14
378*58b9f456SAndroid Build Coastguard Worker    template<typename K>
379*58b9f456SAndroid Build Coastguard Worker        pair<const_iterator,const_iterator> equal_range(const K& x) const;  // C++14
380*58b9f456SAndroid Build Coastguard Worker};
381*58b9f456SAndroid Build Coastguard Worker
382*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
383*58b9f456SAndroid Build Coastguard Workerbool
384*58b9f456SAndroid Build Coastguard Workeroperator==(const multiset<Key, Compare, Allocator>& x,
385*58b9f456SAndroid Build Coastguard Worker           const multiset<Key, Compare, Allocator>& y);
386*58b9f456SAndroid Build Coastguard Worker
387*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
388*58b9f456SAndroid Build Coastguard Workerbool
389*58b9f456SAndroid Build Coastguard Workeroperator< (const multiset<Key, Compare, Allocator>& x,
390*58b9f456SAndroid Build Coastguard Worker           const multiset<Key, Compare, Allocator>& y);
391*58b9f456SAndroid Build Coastguard Worker
392*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
393*58b9f456SAndroid Build Coastguard Workerbool
394*58b9f456SAndroid Build Coastguard Workeroperator!=(const multiset<Key, Compare, Allocator>& x,
395*58b9f456SAndroid Build Coastguard Worker           const multiset<Key, Compare, Allocator>& y);
396*58b9f456SAndroid Build Coastguard Worker
397*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
398*58b9f456SAndroid Build Coastguard Workerbool
399*58b9f456SAndroid Build Coastguard Workeroperator> (const multiset<Key, Compare, Allocator>& x,
400*58b9f456SAndroid Build Coastguard Worker           const multiset<Key, Compare, Allocator>& y);
401*58b9f456SAndroid Build Coastguard Worker
402*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
403*58b9f456SAndroid Build Coastguard Workerbool
404*58b9f456SAndroid Build Coastguard Workeroperator>=(const multiset<Key, Compare, Allocator>& x,
405*58b9f456SAndroid Build Coastguard Worker           const multiset<Key, Compare, Allocator>& y);
406*58b9f456SAndroid Build Coastguard Worker
407*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
408*58b9f456SAndroid Build Coastguard Workerbool
409*58b9f456SAndroid Build Coastguard Workeroperator<=(const multiset<Key, Compare, Allocator>& x,
410*58b9f456SAndroid Build Coastguard Worker           const multiset<Key, Compare, Allocator>& y);
411*58b9f456SAndroid Build Coastguard Worker
412*58b9f456SAndroid Build Coastguard Worker// specialized algorithms:
413*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator>
414*58b9f456SAndroid Build Coastguard Workervoid
415*58b9f456SAndroid Build Coastguard Workerswap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
416*58b9f456SAndroid Build Coastguard Worker    noexcept(noexcept(x.swap(y)));
417*58b9f456SAndroid Build Coastguard Worker
418*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class Compare, class Allocator, class Predicate>
419*58b9f456SAndroid Build Coastguard Worker  void erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred);  // C++20
420*58b9f456SAndroid Build Coastguard Worker
421*58b9f456SAndroid Build Coastguard Worker}  // std
422*58b9f456SAndroid Build Coastguard Worker
423*58b9f456SAndroid Build Coastguard Worker*/
424*58b9f456SAndroid Build Coastguard Worker
425*58b9f456SAndroid Build Coastguard Worker#include <__config>
426*58b9f456SAndroid Build Coastguard Worker#include <__tree>
427*58b9f456SAndroid Build Coastguard Worker#include <__node_handle>
428*58b9f456SAndroid Build Coastguard Worker#include <functional>
429*58b9f456SAndroid Build Coastguard Worker#include <version>
430*58b9f456SAndroid Build Coastguard Worker
431*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
432*58b9f456SAndroid Build Coastguard Worker#pragma GCC system_header
433*58b9f456SAndroid Build Coastguard Worker#endif
434*58b9f456SAndroid Build Coastguard Worker
435*58b9f456SAndroid Build Coastguard Worker_LIBCPP_BEGIN_NAMESPACE_STD
436*58b9f456SAndroid Build Coastguard Worker
437*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
438*58b9f456SAndroid Build Coastguard Workerclass multiset;
439*58b9f456SAndroid Build Coastguard Worker
440*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare = less<_Key>,
441*58b9f456SAndroid Build Coastguard Worker          class _Allocator = allocator<_Key> >
442*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS set
443*58b9f456SAndroid Build Coastguard Worker{
444*58b9f456SAndroid Build Coastguard Workerpublic:
445*58b9f456SAndroid Build Coastguard Worker    // types:
446*58b9f456SAndroid Build Coastguard Worker    typedef _Key                                     key_type;
447*58b9f456SAndroid Build Coastguard Worker    typedef key_type                                 value_type;
448*58b9f456SAndroid Build Coastguard Worker    typedef _Compare                                 key_compare;
449*58b9f456SAndroid Build Coastguard Worker    typedef key_compare                              value_compare;
450*58b9f456SAndroid Build Coastguard Worker    typedef _Allocator                               allocator_type;
451*58b9f456SAndroid Build Coastguard Worker    typedef value_type&                              reference;
452*58b9f456SAndroid Build Coastguard Worker    typedef const value_type&                        const_reference;
453*58b9f456SAndroid Build Coastguard Worker
454*58b9f456SAndroid Build Coastguard Worker    static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
455*58b9f456SAndroid Build Coastguard Worker    static_assert((is_same<typename allocator_type::value_type, value_type>::value),
456*58b9f456SAndroid Build Coastguard Worker                  "Allocator::value_type must be same type as value_type");
457*58b9f456SAndroid Build Coastguard Worker
458*58b9f456SAndroid Build Coastguard Workerprivate:
459*58b9f456SAndroid Build Coastguard Worker    typedef __tree<value_type, value_compare, allocator_type> __base;
460*58b9f456SAndroid Build Coastguard Worker    typedef allocator_traits<allocator_type>                  __alloc_traits;
461*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node_holder                    __node_holder;
462*58b9f456SAndroid Build Coastguard Worker
463*58b9f456SAndroid Build Coastguard Worker    __base __tree_;
464*58b9f456SAndroid Build Coastguard Worker
465*58b9f456SAndroid Build Coastguard Workerpublic:
466*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::pointer               pointer;
467*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::const_pointer         const_pointer;
468*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::size_type             size_type;
469*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::difference_type       difference_type;
470*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::const_iterator        iterator;
471*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::const_iterator        const_iterator;
472*58b9f456SAndroid Build Coastguard Worker    typedef _VSTD::reverse_iterator<iterator>       reverse_iterator;
473*58b9f456SAndroid Build Coastguard Worker    typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
474*58b9f456SAndroid Build Coastguard Worker
475*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
476*58b9f456SAndroid Build Coastguard Worker    typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
477*58b9f456SAndroid Build Coastguard Worker    typedef __insert_return_type<iterator, node_type> insert_return_type;
478*58b9f456SAndroid Build Coastguard Worker#endif
479*58b9f456SAndroid Build Coastguard Worker
480*58b9f456SAndroid Build Coastguard Worker    template <class _Key2, class _Compare2, class _Alloc2>
481*58b9f456SAndroid Build Coastguard Worker        friend class _LIBCPP_TEMPLATE_VIS set;
482*58b9f456SAndroid Build Coastguard Worker    template <class _Key2, class _Compare2, class _Alloc2>
483*58b9f456SAndroid Build Coastguard Worker        friend class _LIBCPP_TEMPLATE_VIS multiset;
484*58b9f456SAndroid Build Coastguard Worker
485*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
486*58b9f456SAndroid Build Coastguard Worker    set()
487*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(
488*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
489*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<key_compare>::value &&
490*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value)
491*58b9f456SAndroid Build Coastguard Worker        : __tree_(value_compare()) {}
492*58b9f456SAndroid Build Coastguard Worker
493*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
494*58b9f456SAndroid Build Coastguard Worker    explicit set(const value_compare& __comp)
495*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(
496*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
497*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value)
498*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp) {}
499*58b9f456SAndroid Build Coastguard Worker
500*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
501*58b9f456SAndroid Build Coastguard Worker    explicit set(const value_compare& __comp, const allocator_type& __a)
502*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp, __a) {}
503*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
504*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
505*58b9f456SAndroid Build Coastguard Worker        set(_InputIterator __f, _InputIterator __l,
506*58b9f456SAndroid Build Coastguard Worker            const value_compare& __comp = value_compare())
507*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp)
508*58b9f456SAndroid Build Coastguard Worker        {
509*58b9f456SAndroid Build Coastguard Worker            insert(__f, __l);
510*58b9f456SAndroid Build Coastguard Worker        }
511*58b9f456SAndroid Build Coastguard Worker
512*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
513*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
514*58b9f456SAndroid Build Coastguard Worker        set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
515*58b9f456SAndroid Build Coastguard Worker            const allocator_type& __a)
516*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp, __a)
517*58b9f456SAndroid Build Coastguard Worker        {
518*58b9f456SAndroid Build Coastguard Worker            insert(__f, __l);
519*58b9f456SAndroid Build Coastguard Worker        }
520*58b9f456SAndroid Build Coastguard Worker
521*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
522*58b9f456SAndroid Build Coastguard Worker        template <class _InputIterator>
523*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
524*58b9f456SAndroid Build Coastguard Worker        set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
525*58b9f456SAndroid Build Coastguard Worker            : set(__f, __l, key_compare(), __a) {}
526*58b9f456SAndroid Build Coastguard Worker#endif
527*58b9f456SAndroid Build Coastguard Worker
528*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
529*58b9f456SAndroid Build Coastguard Worker    set(const set& __s)
530*58b9f456SAndroid Build Coastguard Worker        : __tree_(__s.__tree_)
531*58b9f456SAndroid Build Coastguard Worker        {
532*58b9f456SAndroid Build Coastguard Worker            insert(__s.begin(), __s.end());
533*58b9f456SAndroid Build Coastguard Worker        }
534*58b9f456SAndroid Build Coastguard Worker
535*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
536*58b9f456SAndroid Build Coastguard Worker    set& operator=(const set& __s)
537*58b9f456SAndroid Build Coastguard Worker        {
538*58b9f456SAndroid Build Coastguard Worker            __tree_ = __s.__tree_;
539*58b9f456SAndroid Build Coastguard Worker            return *this;
540*58b9f456SAndroid Build Coastguard Worker        }
541*58b9f456SAndroid Build Coastguard Worker
542*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
543*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
544*58b9f456SAndroid Build Coastguard Worker    set(set&& __s)
545*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
546*58b9f456SAndroid Build Coastguard Worker        : __tree_(_VSTD::move(__s.__tree_)) {}
547*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
548*58b9f456SAndroid Build Coastguard Worker
549*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
550*58b9f456SAndroid Build Coastguard Worker    explicit set(const allocator_type& __a)
551*58b9f456SAndroid Build Coastguard Worker        : __tree_(__a) {}
552*58b9f456SAndroid Build Coastguard Worker
553*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
554*58b9f456SAndroid Build Coastguard Worker    set(const set& __s, const allocator_type& __a)
555*58b9f456SAndroid Build Coastguard Worker        : __tree_(__s.__tree_.value_comp(), __a)
556*58b9f456SAndroid Build Coastguard Worker        {
557*58b9f456SAndroid Build Coastguard Worker            insert(__s.begin(), __s.end());
558*58b9f456SAndroid Build Coastguard Worker        }
559*58b9f456SAndroid Build Coastguard Worker
560*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
561*58b9f456SAndroid Build Coastguard Worker    set(set&& __s, const allocator_type& __a);
562*58b9f456SAndroid Build Coastguard Worker
563*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
564*58b9f456SAndroid Build Coastguard Worker    set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
565*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp)
566*58b9f456SAndroid Build Coastguard Worker        {
567*58b9f456SAndroid Build Coastguard Worker            insert(__il.begin(), __il.end());
568*58b9f456SAndroid Build Coastguard Worker        }
569*58b9f456SAndroid Build Coastguard Worker
570*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
571*58b9f456SAndroid Build Coastguard Worker    set(initializer_list<value_type> __il, const value_compare& __comp,
572*58b9f456SAndroid Build Coastguard Worker        const allocator_type& __a)
573*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp, __a)
574*58b9f456SAndroid Build Coastguard Worker        {
575*58b9f456SAndroid Build Coastguard Worker            insert(__il.begin(), __il.end());
576*58b9f456SAndroid Build Coastguard Worker        }
577*58b9f456SAndroid Build Coastguard Worker
578*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
579*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
580*58b9f456SAndroid Build Coastguard Worker    set(initializer_list<value_type> __il, const allocator_type& __a)
581*58b9f456SAndroid Build Coastguard Worker        : set(__il, key_compare(), __a) {}
582*58b9f456SAndroid Build Coastguard Worker#endif
583*58b9f456SAndroid Build Coastguard Worker
584*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
585*58b9f456SAndroid Build Coastguard Worker    set& operator=(initializer_list<value_type> __il)
586*58b9f456SAndroid Build Coastguard Worker        {
587*58b9f456SAndroid Build Coastguard Worker            __tree_.__assign_unique(__il.begin(), __il.end());
588*58b9f456SAndroid Build Coastguard Worker            return *this;
589*58b9f456SAndroid Build Coastguard Worker        }
590*58b9f456SAndroid Build Coastguard Worker
591*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
592*58b9f456SAndroid Build Coastguard Worker    set& operator=(set&& __s)
593*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
594*58b9f456SAndroid Build Coastguard Worker        {
595*58b9f456SAndroid Build Coastguard Worker            __tree_ = _VSTD::move(__s.__tree_);
596*58b9f456SAndroid Build Coastguard Worker            return *this;
597*58b9f456SAndroid Build Coastguard Worker        }
598*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
599*58b9f456SAndroid Build Coastguard Worker
600*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
601*58b9f456SAndroid Build Coastguard Worker          iterator begin() _NOEXCEPT       {return __tree_.begin();}
602*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
603*58b9f456SAndroid Build Coastguard Worker    const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
604*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
605*58b9f456SAndroid Build Coastguard Worker          iterator end() _NOEXCEPT         {return __tree_.end();}
606*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
607*58b9f456SAndroid Build Coastguard Worker    const_iterator end()   const _NOEXCEPT {return __tree_.end();}
608*58b9f456SAndroid Build Coastguard Worker
609*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
610*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rbegin() _NOEXCEPT
611*58b9f456SAndroid Build Coastguard Worker            {return reverse_iterator(end());}
612*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
613*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rbegin() const _NOEXCEPT
614*58b9f456SAndroid Build Coastguard Worker        {return const_reverse_iterator(end());}
615*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
616*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rend() _NOEXCEPT
617*58b9f456SAndroid Build Coastguard Worker            {return reverse_iterator(begin());}
618*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
619*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rend() const _NOEXCEPT
620*58b9f456SAndroid Build Coastguard Worker        {return const_reverse_iterator(begin());}
621*58b9f456SAndroid Build Coastguard Worker
622*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
623*58b9f456SAndroid Build Coastguard Worker    const_iterator cbegin()  const _NOEXCEPT {return begin();}
624*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
625*58b9f456SAndroid Build Coastguard Worker    const_iterator cend() const _NOEXCEPT {return end();}
626*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
627*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
628*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
629*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crend() const _NOEXCEPT {return rend();}
630*58b9f456SAndroid Build Coastguard Worker
631*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
632*58b9f456SAndroid Build Coastguard Worker    bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
633*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
634*58b9f456SAndroid Build Coastguard Worker    size_type size() const _NOEXCEPT {return __tree_.size();}
635*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
636*58b9f456SAndroid Build Coastguard Worker    size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
637*58b9f456SAndroid Build Coastguard Worker
638*58b9f456SAndroid Build Coastguard Worker    // modifiers:
639*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
640*58b9f456SAndroid Build Coastguard Worker    template <class... _Args>
641*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
642*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> emplace(_Args&&... __args)
643*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
644*58b9f456SAndroid Build Coastguard Worker    template <class... _Args>
645*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
646*58b9f456SAndroid Build Coastguard Worker        iterator emplace_hint(const_iterator __p, _Args&&... __args)
647*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);}
648*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
649*58b9f456SAndroid Build Coastguard Worker
650*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
651*58b9f456SAndroid Build Coastguard Worker    pair<iterator,bool> insert(const value_type& __v)
652*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__insert_unique(__v);}
653*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
654*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __p, const value_type& __v)
655*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__insert_unique(__p, __v);}
656*58b9f456SAndroid Build Coastguard Worker
657*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
658*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
659*58b9f456SAndroid Build Coastguard Worker        void insert(_InputIterator __f, _InputIterator __l)
660*58b9f456SAndroid Build Coastguard Worker        {
661*58b9f456SAndroid Build Coastguard Worker            for (const_iterator __e = cend(); __f != __l; ++__f)
662*58b9f456SAndroid Build Coastguard Worker                __tree_.__insert_unique(__e, *__f);
663*58b9f456SAndroid Build Coastguard Worker        }
664*58b9f456SAndroid Build Coastguard Worker
665*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
666*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
667*58b9f456SAndroid Build Coastguard Worker    pair<iterator,bool> insert(value_type&& __v)
668*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__insert_unique(_VSTD::move(__v));}
669*58b9f456SAndroid Build Coastguard Worker
670*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
671*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __p, value_type&& __v)
672*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__insert_unique(__p, _VSTD::move(__v));}
673*58b9f456SAndroid Build Coastguard Worker
674*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
675*58b9f456SAndroid Build Coastguard Worker    void insert(initializer_list<value_type> __il)
676*58b9f456SAndroid Build Coastguard Worker        {insert(__il.begin(), __il.end());}
677*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
678*58b9f456SAndroid Build Coastguard Worker
679*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
680*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator __p) {return __tree_.erase(__p);}
681*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
682*58b9f456SAndroid Build Coastguard Worker    size_type erase(const key_type& __k)
683*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__erase_unique(__k);}
684*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
685*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator __f, const_iterator __l)
686*58b9f456SAndroid Build Coastguard Worker        {return __tree_.erase(__f, __l);}
687*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
688*58b9f456SAndroid Build Coastguard Worker    void clear() _NOEXCEPT {__tree_.clear();}
689*58b9f456SAndroid Build Coastguard Worker
690*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
691*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
692*58b9f456SAndroid Build Coastguard Worker    insert_return_type insert(node_type&& __nh)
693*58b9f456SAndroid Build Coastguard Worker    {
694*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
695*58b9f456SAndroid Build Coastguard Worker            "node_type with incompatible allocator passed to set::insert()");
696*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_insert_unique<
697*58b9f456SAndroid Build Coastguard Worker            node_type, insert_return_type>(_VSTD::move(__nh));
698*58b9f456SAndroid Build Coastguard Worker    }
699*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
700*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __hint, node_type&& __nh)
701*58b9f456SAndroid Build Coastguard Worker    {
702*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
703*58b9f456SAndroid Build Coastguard Worker            "node_type with incompatible allocator passed to set::insert()");
704*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_insert_unique<node_type>(
705*58b9f456SAndroid Build Coastguard Worker            __hint, _VSTD::move(__nh));
706*58b9f456SAndroid Build Coastguard Worker    }
707*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
708*58b9f456SAndroid Build Coastguard Worker    node_type extract(key_type const& __key)
709*58b9f456SAndroid Build Coastguard Worker    {
710*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_extract<node_type>(__key);
711*58b9f456SAndroid Build Coastguard Worker    }
712*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
713*58b9f456SAndroid Build Coastguard Worker    node_type extract(const_iterator __it)
714*58b9f456SAndroid Build Coastguard Worker    {
715*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_extract<node_type>(__it);
716*58b9f456SAndroid Build Coastguard Worker    }
717*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
718*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
719*58b9f456SAndroid Build Coastguard Worker    void merge(set<key_type, _Compare2, allocator_type>& __source)
720*58b9f456SAndroid Build Coastguard Worker    {
721*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
722*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
723*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_unique(__source.__tree_);
724*58b9f456SAndroid Build Coastguard Worker    }
725*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
726*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
727*58b9f456SAndroid Build Coastguard Worker    void merge(set<key_type, _Compare2, allocator_type>&& __source)
728*58b9f456SAndroid Build Coastguard Worker    {
729*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
730*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
731*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_unique(__source.__tree_);
732*58b9f456SAndroid Build Coastguard Worker    }
733*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
734*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
735*58b9f456SAndroid Build Coastguard Worker    void merge(multiset<key_type, _Compare2, allocator_type>& __source)
736*58b9f456SAndroid Build Coastguard Worker    {
737*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
738*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
739*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_unique(__source.__tree_);
740*58b9f456SAndroid Build Coastguard Worker    }
741*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
742*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
743*58b9f456SAndroid Build Coastguard Worker    void merge(multiset<key_type, _Compare2, allocator_type>&& __source)
744*58b9f456SAndroid Build Coastguard Worker    {
745*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
746*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
747*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_unique(__source.__tree_);
748*58b9f456SAndroid Build Coastguard Worker    }
749*58b9f456SAndroid Build Coastguard Worker#endif
750*58b9f456SAndroid Build Coastguard Worker
751*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
752*58b9f456SAndroid Build Coastguard Worker    void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
753*58b9f456SAndroid Build Coastguard Worker        {__tree_.swap(__s.__tree_);}
754*58b9f456SAndroid Build Coastguard Worker
755*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
756*58b9f456SAndroid Build Coastguard Worker    allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
757*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
758*58b9f456SAndroid Build Coastguard Worker    key_compare    key_comp()      const {return __tree_.value_comp();}
759*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
760*58b9f456SAndroid Build Coastguard Worker    value_compare  value_comp()    const {return __tree_.value_comp();}
761*58b9f456SAndroid Build Coastguard Worker
762*58b9f456SAndroid Build Coastguard Worker    // set operations:
763*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
764*58b9f456SAndroid Build Coastguard Worker    iterator find(const key_type& __k)             {return __tree_.find(__k);}
765*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
766*58b9f456SAndroid Build Coastguard Worker    const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
767*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
768*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
769*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
770*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
771*58b9f456SAndroid Build Coastguard Worker    find(const _K2& __k)                           {return __tree_.find(__k);}
772*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
773*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
774*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
775*58b9f456SAndroid Build Coastguard Worker    find(const _K2& __k) const                     {return __tree_.find(__k);}
776*58b9f456SAndroid Build Coastguard Worker#endif
777*58b9f456SAndroid Build Coastguard Worker
778*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
779*58b9f456SAndroid Build Coastguard Worker    size_type      count(const key_type& __k) const
780*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__count_unique(__k);}
781*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
782*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
783*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
784*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
785*58b9f456SAndroid Build Coastguard Worker    count(const _K2& __k) const                    {return __tree_.__count_multi(__k);}
786*58b9f456SAndroid Build Coastguard Worker#endif
787*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
788*58b9f456SAndroid Build Coastguard Worker    iterator lower_bound(const key_type& __k)
789*58b9f456SAndroid Build Coastguard Worker        {return __tree_.lower_bound(__k);}
790*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
791*58b9f456SAndroid Build Coastguard Worker    const_iterator lower_bound(const key_type& __k) const
792*58b9f456SAndroid Build Coastguard Worker        {return __tree_.lower_bound(__k);}
793*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
794*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
795*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
796*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
797*58b9f456SAndroid Build Coastguard Worker    lower_bound(const _K2& __k)       {return __tree_.lower_bound(__k);}
798*58b9f456SAndroid Build Coastguard Worker
799*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
800*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
801*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
802*58b9f456SAndroid Build Coastguard Worker    lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
803*58b9f456SAndroid Build Coastguard Worker#endif
804*58b9f456SAndroid Build Coastguard Worker
805*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
806*58b9f456SAndroid Build Coastguard Worker    iterator upper_bound(const key_type& __k)
807*58b9f456SAndroid Build Coastguard Worker        {return __tree_.upper_bound(__k);}
808*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
809*58b9f456SAndroid Build Coastguard Worker    const_iterator upper_bound(const key_type& __k) const
810*58b9f456SAndroid Build Coastguard Worker        {return __tree_.upper_bound(__k);}
811*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
812*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
813*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
814*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
815*58b9f456SAndroid Build Coastguard Worker    upper_bound(const _K2& __k)       {return __tree_.upper_bound(__k);}
816*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
817*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
818*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
819*58b9f456SAndroid Build Coastguard Worker    upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
820*58b9f456SAndroid Build Coastguard Worker#endif
821*58b9f456SAndroid Build Coastguard Worker
822*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
823*58b9f456SAndroid Build Coastguard Worker    pair<iterator,iterator> equal_range(const key_type& __k)
824*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__equal_range_unique(__k);}
825*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
826*58b9f456SAndroid Build Coastguard Worker    pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
827*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__equal_range_unique(__k);}
828*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
829*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
830*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
831*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
832*58b9f456SAndroid Build Coastguard Worker    equal_range(const _K2& __k)       {return __tree_.__equal_range_multi(__k);}
833*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
834*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
835*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
836*58b9f456SAndroid Build Coastguard Worker    equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
837*58b9f456SAndroid Build Coastguard Worker#endif
838*58b9f456SAndroid Build Coastguard Worker};
839*58b9f456SAndroid Build Coastguard Worker
840*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
841*58b9f456SAndroid Build Coastguard Worker
842*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
843*58b9f456SAndroid Build Coastguard Workerset<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
844*58b9f456SAndroid Build Coastguard Worker    : __tree_(_VSTD::move(__s.__tree_), __a)
845*58b9f456SAndroid Build Coastguard Worker{
846*58b9f456SAndroid Build Coastguard Worker    if (__a != __s.get_allocator())
847*58b9f456SAndroid Build Coastguard Worker    {
848*58b9f456SAndroid Build Coastguard Worker        const_iterator __e = cend();
849*58b9f456SAndroid Build Coastguard Worker        while (!__s.empty())
850*58b9f456SAndroid Build Coastguard Worker            insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
851*58b9f456SAndroid Build Coastguard Worker    }
852*58b9f456SAndroid Build Coastguard Worker}
853*58b9f456SAndroid Build Coastguard Worker
854*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
855*58b9f456SAndroid Build Coastguard Worker
856*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
857*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
858*58b9f456SAndroid Build Coastguard Workerbool
859*58b9f456SAndroid Build Coastguard Workeroperator==(const set<_Key, _Compare, _Allocator>& __x,
860*58b9f456SAndroid Build Coastguard Worker           const set<_Key, _Compare, _Allocator>& __y)
861*58b9f456SAndroid Build Coastguard Worker{
862*58b9f456SAndroid Build Coastguard Worker    return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
863*58b9f456SAndroid Build Coastguard Worker}
864*58b9f456SAndroid Build Coastguard Worker
865*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
866*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
867*58b9f456SAndroid Build Coastguard Workerbool
868*58b9f456SAndroid Build Coastguard Workeroperator< (const set<_Key, _Compare, _Allocator>& __x,
869*58b9f456SAndroid Build Coastguard Worker           const set<_Key, _Compare, _Allocator>& __y)
870*58b9f456SAndroid Build Coastguard Worker{
871*58b9f456SAndroid Build Coastguard Worker    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
872*58b9f456SAndroid Build Coastguard Worker}
873*58b9f456SAndroid Build Coastguard Worker
874*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
875*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
876*58b9f456SAndroid Build Coastguard Workerbool
877*58b9f456SAndroid Build Coastguard Workeroperator!=(const set<_Key, _Compare, _Allocator>& __x,
878*58b9f456SAndroid Build Coastguard Worker           const set<_Key, _Compare, _Allocator>& __y)
879*58b9f456SAndroid Build Coastguard Worker{
880*58b9f456SAndroid Build Coastguard Worker    return !(__x == __y);
881*58b9f456SAndroid Build Coastguard Worker}
882*58b9f456SAndroid Build Coastguard Worker
883*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
884*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
885*58b9f456SAndroid Build Coastguard Workerbool
886*58b9f456SAndroid Build Coastguard Workeroperator> (const set<_Key, _Compare, _Allocator>& __x,
887*58b9f456SAndroid Build Coastguard Worker           const set<_Key, _Compare, _Allocator>& __y)
888*58b9f456SAndroid Build Coastguard Worker{
889*58b9f456SAndroid Build Coastguard Worker    return __y < __x;
890*58b9f456SAndroid Build Coastguard Worker}
891*58b9f456SAndroid Build Coastguard Worker
892*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
893*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
894*58b9f456SAndroid Build Coastguard Workerbool
895*58b9f456SAndroid Build Coastguard Workeroperator>=(const set<_Key, _Compare, _Allocator>& __x,
896*58b9f456SAndroid Build Coastguard Worker           const set<_Key, _Compare, _Allocator>& __y)
897*58b9f456SAndroid Build Coastguard Worker{
898*58b9f456SAndroid Build Coastguard Worker    return !(__x < __y);
899*58b9f456SAndroid Build Coastguard Worker}
900*58b9f456SAndroid Build Coastguard Worker
901*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
902*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
903*58b9f456SAndroid Build Coastguard Workerbool
904*58b9f456SAndroid Build Coastguard Workeroperator<=(const set<_Key, _Compare, _Allocator>& __x,
905*58b9f456SAndroid Build Coastguard Worker           const set<_Key, _Compare, _Allocator>& __y)
906*58b9f456SAndroid Build Coastguard Worker{
907*58b9f456SAndroid Build Coastguard Worker    return !(__y < __x);
908*58b9f456SAndroid Build Coastguard Worker}
909*58b9f456SAndroid Build Coastguard Worker
910*58b9f456SAndroid Build Coastguard Worker// specialized algorithms:
911*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
912*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
913*58b9f456SAndroid Build Coastguard Workervoid
914*58b9f456SAndroid Build Coastguard Workerswap(set<_Key, _Compare, _Allocator>& __x,
915*58b9f456SAndroid Build Coastguard Worker     set<_Key, _Compare, _Allocator>& __y)
916*58b9f456SAndroid Build Coastguard Worker    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
917*58b9f456SAndroid Build Coastguard Worker{
918*58b9f456SAndroid Build Coastguard Worker    __x.swap(__y);
919*58b9f456SAndroid Build Coastguard Worker}
920*58b9f456SAndroid Build Coastguard Worker
921*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 17
922*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator, class _Predicate>
923*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
924*58b9f456SAndroid Build Coastguard Workervoid erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred)
925*58b9f456SAndroid Build Coastguard Worker{ __libcpp_erase_if_container(__c, __pred); }
926*58b9f456SAndroid Build Coastguard Worker#endif
927*58b9f456SAndroid Build Coastguard Worker
928*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare = less<_Key>,
929*58b9f456SAndroid Build Coastguard Worker          class _Allocator = allocator<_Key> >
930*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS multiset
931*58b9f456SAndroid Build Coastguard Worker{
932*58b9f456SAndroid Build Coastguard Workerpublic:
933*58b9f456SAndroid Build Coastguard Worker    // types:
934*58b9f456SAndroid Build Coastguard Worker    typedef _Key                                      key_type;
935*58b9f456SAndroid Build Coastguard Worker    typedef key_type                                 value_type;
936*58b9f456SAndroid Build Coastguard Worker    typedef _Compare                                  key_compare;
937*58b9f456SAndroid Build Coastguard Worker    typedef key_compare                              value_compare;
938*58b9f456SAndroid Build Coastguard Worker    typedef _Allocator                                allocator_type;
939*58b9f456SAndroid Build Coastguard Worker    typedef value_type&                              reference;
940*58b9f456SAndroid Build Coastguard Worker    typedef const value_type&                        const_reference;
941*58b9f456SAndroid Build Coastguard Worker
942*58b9f456SAndroid Build Coastguard Worker    static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
943*58b9f456SAndroid Build Coastguard Worker    static_assert((is_same<typename allocator_type::value_type, value_type>::value),
944*58b9f456SAndroid Build Coastguard Worker                  "Allocator::value_type must be same type as value_type");
945*58b9f456SAndroid Build Coastguard Worker
946*58b9f456SAndroid Build Coastguard Workerprivate:
947*58b9f456SAndroid Build Coastguard Worker    typedef __tree<value_type, value_compare, allocator_type> __base;
948*58b9f456SAndroid Build Coastguard Worker    typedef allocator_traits<allocator_type>                  __alloc_traits;
949*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node_holder                    __node_holder;
950*58b9f456SAndroid Build Coastguard Worker
951*58b9f456SAndroid Build Coastguard Worker    __base __tree_;
952*58b9f456SAndroid Build Coastguard Worker
953*58b9f456SAndroid Build Coastguard Workerpublic:
954*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::pointer               pointer;
955*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::const_pointer         const_pointer;
956*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::size_type             size_type;
957*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::difference_type       difference_type;
958*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::const_iterator        iterator;
959*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::const_iterator        const_iterator;
960*58b9f456SAndroid Build Coastguard Worker    typedef _VSTD::reverse_iterator<iterator>       reverse_iterator;
961*58b9f456SAndroid Build Coastguard Worker    typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
962*58b9f456SAndroid Build Coastguard Worker
963*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
964*58b9f456SAndroid Build Coastguard Worker    typedef __set_node_handle<typename __base::__node, allocator_type> node_type;
965*58b9f456SAndroid Build Coastguard Worker#endif
966*58b9f456SAndroid Build Coastguard Worker
967*58b9f456SAndroid Build Coastguard Worker    template <class _Key2, class _Compare2, class _Alloc2>
968*58b9f456SAndroid Build Coastguard Worker        friend class _LIBCPP_TEMPLATE_VIS set;
969*58b9f456SAndroid Build Coastguard Worker    template <class _Key2, class _Compare2, class _Alloc2>
970*58b9f456SAndroid Build Coastguard Worker        friend class _LIBCPP_TEMPLATE_VIS multiset;
971*58b9f456SAndroid Build Coastguard Worker
972*58b9f456SAndroid Build Coastguard Worker    // construct/copy/destroy:
973*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
974*58b9f456SAndroid Build Coastguard Worker    multiset()
975*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(
976*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
977*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<key_compare>::value &&
978*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value)
979*58b9f456SAndroid Build Coastguard Worker        : __tree_(value_compare()) {}
980*58b9f456SAndroid Build Coastguard Worker
981*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
982*58b9f456SAndroid Build Coastguard Worker    explicit multiset(const value_compare& __comp)
983*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(
984*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
985*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value)
986*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp) {}
987*58b9f456SAndroid Build Coastguard Worker
988*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
989*58b9f456SAndroid Build Coastguard Worker    explicit multiset(const value_compare& __comp, const allocator_type& __a)
990*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp, __a) {}
991*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
992*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
993*58b9f456SAndroid Build Coastguard Worker        multiset(_InputIterator __f, _InputIterator __l,
994*58b9f456SAndroid Build Coastguard Worker                 const value_compare& __comp = value_compare())
995*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp)
996*58b9f456SAndroid Build Coastguard Worker        {
997*58b9f456SAndroid Build Coastguard Worker            insert(__f, __l);
998*58b9f456SAndroid Build Coastguard Worker        }
999*58b9f456SAndroid Build Coastguard Worker
1000*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1001*58b9f456SAndroid Build Coastguard Worker        template <class _InputIterator>
1002*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1003*58b9f456SAndroid Build Coastguard Worker        multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
1004*58b9f456SAndroid Build Coastguard Worker            : multiset(__f, __l, key_compare(), __a) {}
1005*58b9f456SAndroid Build Coastguard Worker#endif
1006*58b9f456SAndroid Build Coastguard Worker
1007*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
1008*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1009*58b9f456SAndroid Build Coastguard Worker        multiset(_InputIterator __f, _InputIterator __l,
1010*58b9f456SAndroid Build Coastguard Worker                 const value_compare& __comp, const allocator_type& __a)
1011*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp, __a)
1012*58b9f456SAndroid Build Coastguard Worker        {
1013*58b9f456SAndroid Build Coastguard Worker            insert(__f, __l);
1014*58b9f456SAndroid Build Coastguard Worker        }
1015*58b9f456SAndroid Build Coastguard Worker
1016*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1017*58b9f456SAndroid Build Coastguard Worker    multiset(const multiset& __s)
1018*58b9f456SAndroid Build Coastguard Worker        : __tree_(__s.__tree_.value_comp(),
1019*58b9f456SAndroid Build Coastguard Worker          __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
1020*58b9f456SAndroid Build Coastguard Worker        {
1021*58b9f456SAndroid Build Coastguard Worker            insert(__s.begin(), __s.end());
1022*58b9f456SAndroid Build Coastguard Worker        }
1023*58b9f456SAndroid Build Coastguard Worker
1024*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1025*58b9f456SAndroid Build Coastguard Worker    multiset& operator=(const multiset& __s)
1026*58b9f456SAndroid Build Coastguard Worker        {
1027*58b9f456SAndroid Build Coastguard Worker            __tree_ = __s.__tree_;
1028*58b9f456SAndroid Build Coastguard Worker            return *this;
1029*58b9f456SAndroid Build Coastguard Worker        }
1030*58b9f456SAndroid Build Coastguard Worker
1031*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1032*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1033*58b9f456SAndroid Build Coastguard Worker    multiset(multiset&& __s)
1034*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
1035*58b9f456SAndroid Build Coastguard Worker        : __tree_(_VSTD::move(__s.__tree_)) {}
1036*58b9f456SAndroid Build Coastguard Worker
1037*58b9f456SAndroid Build Coastguard Worker    multiset(multiset&& __s, const allocator_type& __a);
1038*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
1039*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1040*58b9f456SAndroid Build Coastguard Worker    explicit multiset(const allocator_type& __a)
1041*58b9f456SAndroid Build Coastguard Worker        : __tree_(__a) {}
1042*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1043*58b9f456SAndroid Build Coastguard Worker    multiset(const multiset& __s, const allocator_type& __a)
1044*58b9f456SAndroid Build Coastguard Worker        : __tree_(__s.__tree_.value_comp(), __a)
1045*58b9f456SAndroid Build Coastguard Worker        {
1046*58b9f456SAndroid Build Coastguard Worker            insert(__s.begin(), __s.end());
1047*58b9f456SAndroid Build Coastguard Worker        }
1048*58b9f456SAndroid Build Coastguard Worker
1049*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1050*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1051*58b9f456SAndroid Build Coastguard Worker    multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
1052*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp)
1053*58b9f456SAndroid Build Coastguard Worker        {
1054*58b9f456SAndroid Build Coastguard Worker            insert(__il.begin(), __il.end());
1055*58b9f456SAndroid Build Coastguard Worker        }
1056*58b9f456SAndroid Build Coastguard Worker
1057*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1058*58b9f456SAndroid Build Coastguard Worker    multiset(initializer_list<value_type> __il, const value_compare& __comp,
1059*58b9f456SAndroid Build Coastguard Worker        const allocator_type& __a)
1060*58b9f456SAndroid Build Coastguard Worker        : __tree_(__comp, __a)
1061*58b9f456SAndroid Build Coastguard Worker        {
1062*58b9f456SAndroid Build Coastguard Worker            insert(__il.begin(), __il.end());
1063*58b9f456SAndroid Build Coastguard Worker        }
1064*58b9f456SAndroid Build Coastguard Worker
1065*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1066*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1067*58b9f456SAndroid Build Coastguard Worker    multiset(initializer_list<value_type> __il, const allocator_type& __a)
1068*58b9f456SAndroid Build Coastguard Worker        : multiset(__il, key_compare(), __a) {}
1069*58b9f456SAndroid Build Coastguard Worker#endif
1070*58b9f456SAndroid Build Coastguard Worker
1071*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1072*58b9f456SAndroid Build Coastguard Worker    multiset& operator=(initializer_list<value_type> __il)
1073*58b9f456SAndroid Build Coastguard Worker        {
1074*58b9f456SAndroid Build Coastguard Worker            __tree_.__assign_multi(__il.begin(), __il.end());
1075*58b9f456SAndroid Build Coastguard Worker            return *this;
1076*58b9f456SAndroid Build Coastguard Worker        }
1077*58b9f456SAndroid Build Coastguard Worker
1078*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1079*58b9f456SAndroid Build Coastguard Worker    multiset& operator=(multiset&& __s)
1080*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
1081*58b9f456SAndroid Build Coastguard Worker        {
1082*58b9f456SAndroid Build Coastguard Worker            __tree_ = _VSTD::move(__s.__tree_);
1083*58b9f456SAndroid Build Coastguard Worker            return *this;
1084*58b9f456SAndroid Build Coastguard Worker        }
1085*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
1086*58b9f456SAndroid Build Coastguard Worker
1087*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1088*58b9f456SAndroid Build Coastguard Worker          iterator begin() _NOEXCEPT       {return __tree_.begin();}
1089*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1090*58b9f456SAndroid Build Coastguard Worker    const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
1091*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1092*58b9f456SAndroid Build Coastguard Worker          iterator end() _NOEXCEPT         {return __tree_.end();}
1093*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1094*58b9f456SAndroid Build Coastguard Worker    const_iterator end()   const _NOEXCEPT {return __tree_.end();}
1095*58b9f456SAndroid Build Coastguard Worker
1096*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1097*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rbegin() _NOEXCEPT
1098*58b9f456SAndroid Build Coastguard Worker            {return reverse_iterator(end());}
1099*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1100*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rbegin() const _NOEXCEPT
1101*58b9f456SAndroid Build Coastguard Worker        {return const_reverse_iterator(end());}
1102*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1103*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rend() _NOEXCEPT
1104*58b9f456SAndroid Build Coastguard Worker            {return       reverse_iterator(begin());}
1105*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1106*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rend() const _NOEXCEPT
1107*58b9f456SAndroid Build Coastguard Worker        {return const_reverse_iterator(begin());}
1108*58b9f456SAndroid Build Coastguard Worker
1109*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1110*58b9f456SAndroid Build Coastguard Worker    const_iterator cbegin()  const _NOEXCEPT {return begin();}
1111*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1112*58b9f456SAndroid Build Coastguard Worker    const_iterator cend() const _NOEXCEPT {return end();}
1113*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1114*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
1115*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1116*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crend() const _NOEXCEPT {return rend();}
1117*58b9f456SAndroid Build Coastguard Worker
1118*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
1119*58b9f456SAndroid Build Coastguard Worker    bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
1120*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1121*58b9f456SAndroid Build Coastguard Worker    size_type size() const _NOEXCEPT {return __tree_.size();}
1122*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1123*58b9f456SAndroid Build Coastguard Worker    size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
1124*58b9f456SAndroid Build Coastguard Worker
1125*58b9f456SAndroid Build Coastguard Worker    // modifiers:
1126*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1127*58b9f456SAndroid Build Coastguard Worker    template <class... _Args>
1128*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1129*58b9f456SAndroid Build Coastguard Worker        iterator emplace(_Args&&... __args)
1130*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
1131*58b9f456SAndroid Build Coastguard Worker    template <class... _Args>
1132*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1133*58b9f456SAndroid Build Coastguard Worker        iterator emplace_hint(const_iterator __p, _Args&&... __args)
1134*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
1135*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
1136*58b9f456SAndroid Build Coastguard Worker
1137*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1138*58b9f456SAndroid Build Coastguard Worker    iterator insert(const value_type& __v)
1139*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__insert_multi(__v);}
1140*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1141*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __p, const value_type& __v)
1142*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__insert_multi(__p, __v);}
1143*58b9f456SAndroid Build Coastguard Worker
1144*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
1145*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1146*58b9f456SAndroid Build Coastguard Worker        void insert(_InputIterator __f, _InputIterator __l)
1147*58b9f456SAndroid Build Coastguard Worker        {
1148*58b9f456SAndroid Build Coastguard Worker            for (const_iterator __e = cend(); __f != __l; ++__f)
1149*58b9f456SAndroid Build Coastguard Worker                __tree_.__insert_multi(__e, *__f);
1150*58b9f456SAndroid Build Coastguard Worker        }
1151*58b9f456SAndroid Build Coastguard Worker
1152*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1153*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1154*58b9f456SAndroid Build Coastguard Worker    iterator insert(value_type&& __v)
1155*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__insert_multi(_VSTD::move(__v));}
1156*58b9f456SAndroid Build Coastguard Worker
1157*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1158*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __p, value_type&& __v)
1159*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__insert_multi(__p, _VSTD::move(__v));}
1160*58b9f456SAndroid Build Coastguard Worker
1161*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1162*58b9f456SAndroid Build Coastguard Worker    void insert(initializer_list<value_type> __il)
1163*58b9f456SAndroid Build Coastguard Worker        {insert(__il.begin(), __il.end());}
1164*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
1165*58b9f456SAndroid Build Coastguard Worker
1166*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1167*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator __p) {return __tree_.erase(__p);}
1168*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1169*58b9f456SAndroid Build Coastguard Worker    size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
1170*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1171*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator __f, const_iterator __l)
1172*58b9f456SAndroid Build Coastguard Worker        {return __tree_.erase(__f, __l);}
1173*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1174*58b9f456SAndroid Build Coastguard Worker    void clear() _NOEXCEPT {__tree_.clear();}
1175*58b9f456SAndroid Build Coastguard Worker
1176*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
1177*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1178*58b9f456SAndroid Build Coastguard Worker    iterator insert(node_type&& __nh)
1179*58b9f456SAndroid Build Coastguard Worker    {
1180*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
1181*58b9f456SAndroid Build Coastguard Worker            "node_type with incompatible allocator passed to multiset::insert()");
1182*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_insert_multi<node_type>(
1183*58b9f456SAndroid Build Coastguard Worker            _VSTD::move(__nh));
1184*58b9f456SAndroid Build Coastguard Worker    }
1185*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1186*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __hint, node_type&& __nh)
1187*58b9f456SAndroid Build Coastguard Worker    {
1188*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
1189*58b9f456SAndroid Build Coastguard Worker            "node_type with incompatible allocator passed to multiset::insert()");
1190*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_insert_multi<node_type>(
1191*58b9f456SAndroid Build Coastguard Worker            __hint, _VSTD::move(__nh));
1192*58b9f456SAndroid Build Coastguard Worker    }
1193*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1194*58b9f456SAndroid Build Coastguard Worker    node_type extract(key_type const& __key)
1195*58b9f456SAndroid Build Coastguard Worker    {
1196*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_extract<node_type>(__key);
1197*58b9f456SAndroid Build Coastguard Worker    }
1198*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1199*58b9f456SAndroid Build Coastguard Worker    node_type extract(const_iterator __it)
1200*58b9f456SAndroid Build Coastguard Worker    {
1201*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_extract<node_type>(__it);
1202*58b9f456SAndroid Build Coastguard Worker    }
1203*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1204*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1205*58b9f456SAndroid Build Coastguard Worker    void merge(multiset<key_type, _Compare2, allocator_type>& __source)
1206*58b9f456SAndroid Build Coastguard Worker    {
1207*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1208*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1209*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_multi(__source.__tree_);
1210*58b9f456SAndroid Build Coastguard Worker    }
1211*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1212*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1213*58b9f456SAndroid Build Coastguard Worker    void merge(multiset<key_type, _Compare2, allocator_type>&& __source)
1214*58b9f456SAndroid Build Coastguard Worker    {
1215*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1216*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1217*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_multi(__source.__tree_);
1218*58b9f456SAndroid Build Coastguard Worker    }
1219*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1220*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1221*58b9f456SAndroid Build Coastguard Worker    void merge(set<key_type, _Compare2, allocator_type>& __source)
1222*58b9f456SAndroid Build Coastguard Worker    {
1223*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1224*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1225*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_multi(__source.__tree_);
1226*58b9f456SAndroid Build Coastguard Worker    }
1227*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1228*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1229*58b9f456SAndroid Build Coastguard Worker    void merge(set<key_type, _Compare2, allocator_type>&& __source)
1230*58b9f456SAndroid Build Coastguard Worker    {
1231*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1232*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1233*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_multi(__source.__tree_);
1234*58b9f456SAndroid Build Coastguard Worker    }
1235*58b9f456SAndroid Build Coastguard Worker#endif
1236*58b9f456SAndroid Build Coastguard Worker
1237*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1238*58b9f456SAndroid Build Coastguard Worker    void swap(multiset& __s)
1239*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
1240*58b9f456SAndroid Build Coastguard Worker        {__tree_.swap(__s.__tree_);}
1241*58b9f456SAndroid Build Coastguard Worker
1242*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1243*58b9f456SAndroid Build Coastguard Worker    allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
1244*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1245*58b9f456SAndroid Build Coastguard Worker    key_compare    key_comp()      const {return __tree_.value_comp();}
1246*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1247*58b9f456SAndroid Build Coastguard Worker    value_compare  value_comp()    const {return __tree_.value_comp();}
1248*58b9f456SAndroid Build Coastguard Worker
1249*58b9f456SAndroid Build Coastguard Worker    // set operations:
1250*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1251*58b9f456SAndroid Build Coastguard Worker    iterator find(const key_type& __k)             {return __tree_.find(__k);}
1252*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1253*58b9f456SAndroid Build Coastguard Worker    const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
1254*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1255*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1256*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1257*58b9f456SAndroid Build Coastguard Worker    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
1258*58b9f456SAndroid Build Coastguard Worker    find(const _K2& __k)                           {return __tree_.find(__k);}
1259*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1260*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1261*58b9f456SAndroid Build Coastguard Worker    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
1262*58b9f456SAndroid Build Coastguard Worker    find(const _K2& __k) const                     {return __tree_.find(__k);}
1263*58b9f456SAndroid Build Coastguard Worker#endif
1264*58b9f456SAndroid Build Coastguard Worker
1265*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1266*58b9f456SAndroid Build Coastguard Worker    size_type      count(const key_type& __k) const
1267*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__count_multi(__k);}
1268*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1269*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1270*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1271*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
1272*58b9f456SAndroid Build Coastguard Worker    count(const _K2& __k) const            {return __tree_.__count_multi(__k);}
1273*58b9f456SAndroid Build Coastguard Worker#endif
1274*58b9f456SAndroid Build Coastguard Worker
1275*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1276*58b9f456SAndroid Build Coastguard Worker    iterator lower_bound(const key_type& __k)
1277*58b9f456SAndroid Build Coastguard Worker        {return __tree_.lower_bound(__k);}
1278*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1279*58b9f456SAndroid Build Coastguard Worker    const_iterator lower_bound(const key_type& __k) const
1280*58b9f456SAndroid Build Coastguard Worker            {return __tree_.lower_bound(__k);}
1281*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1282*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1283*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1284*58b9f456SAndroid Build Coastguard Worker    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
1285*58b9f456SAndroid Build Coastguard Worker    lower_bound(const _K2& __k)       {return __tree_.lower_bound(__k);}
1286*58b9f456SAndroid Build Coastguard Worker
1287*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1288*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1289*58b9f456SAndroid Build Coastguard Worker    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
1290*58b9f456SAndroid Build Coastguard Worker    lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
1291*58b9f456SAndroid Build Coastguard Worker#endif
1292*58b9f456SAndroid Build Coastguard Worker
1293*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1294*58b9f456SAndroid Build Coastguard Worker    iterator upper_bound(const key_type& __k)
1295*58b9f456SAndroid Build Coastguard Worker            {return __tree_.upper_bound(__k);}
1296*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1297*58b9f456SAndroid Build Coastguard Worker    const_iterator upper_bound(const key_type& __k) const
1298*58b9f456SAndroid Build Coastguard Worker            {return __tree_.upper_bound(__k);}
1299*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1300*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1301*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1302*58b9f456SAndroid Build Coastguard Worker    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
1303*58b9f456SAndroid Build Coastguard Worker    upper_bound(const _K2& __k)       {return __tree_.upper_bound(__k);}
1304*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1305*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1306*58b9f456SAndroid Build Coastguard Worker    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
1307*58b9f456SAndroid Build Coastguard Worker    upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
1308*58b9f456SAndroid Build Coastguard Worker#endif
1309*58b9f456SAndroid Build Coastguard Worker
1310*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1311*58b9f456SAndroid Build Coastguard Worker    pair<iterator,iterator>             equal_range(const key_type& __k)
1312*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__equal_range_multi(__k);}
1313*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1314*58b9f456SAndroid Build Coastguard Worker    pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
1315*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__equal_range_multi(__k);}
1316*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1317*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1318*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1319*58b9f456SAndroid Build Coastguard Worker    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
1320*58b9f456SAndroid Build Coastguard Worker    equal_range(const _K2& __k)       {return __tree_.__equal_range_multi(__k);}
1321*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1322*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1323*58b9f456SAndroid Build Coastguard Worker    typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
1324*58b9f456SAndroid Build Coastguard Worker    equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
1325*58b9f456SAndroid Build Coastguard Worker#endif
1326*58b9f456SAndroid Build Coastguard Worker};
1327*58b9f456SAndroid Build Coastguard Worker
1328*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1329*58b9f456SAndroid Build Coastguard Worker
1330*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
1331*58b9f456SAndroid Build Coastguard Workermultiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
1332*58b9f456SAndroid Build Coastguard Worker    : __tree_(_VSTD::move(__s.__tree_), __a)
1333*58b9f456SAndroid Build Coastguard Worker{
1334*58b9f456SAndroid Build Coastguard Worker    if (__a != __s.get_allocator())
1335*58b9f456SAndroid Build Coastguard Worker    {
1336*58b9f456SAndroid Build Coastguard Worker        const_iterator __e = cend();
1337*58b9f456SAndroid Build Coastguard Worker        while (!__s.empty())
1338*58b9f456SAndroid Build Coastguard Worker            insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
1339*58b9f456SAndroid Build Coastguard Worker    }
1340*58b9f456SAndroid Build Coastguard Worker}
1341*58b9f456SAndroid Build Coastguard Worker
1342*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
1343*58b9f456SAndroid Build Coastguard Worker
1344*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
1345*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1346*58b9f456SAndroid Build Coastguard Workerbool
1347*58b9f456SAndroid Build Coastguard Workeroperator==(const multiset<_Key, _Compare, _Allocator>& __x,
1348*58b9f456SAndroid Build Coastguard Worker           const multiset<_Key, _Compare, _Allocator>& __y)
1349*58b9f456SAndroid Build Coastguard Worker{
1350*58b9f456SAndroid Build Coastguard Worker    return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
1351*58b9f456SAndroid Build Coastguard Worker}
1352*58b9f456SAndroid Build Coastguard Worker
1353*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
1354*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1355*58b9f456SAndroid Build Coastguard Workerbool
1356*58b9f456SAndroid Build Coastguard Workeroperator< (const multiset<_Key, _Compare, _Allocator>& __x,
1357*58b9f456SAndroid Build Coastguard Worker           const multiset<_Key, _Compare, _Allocator>& __y)
1358*58b9f456SAndroid Build Coastguard Worker{
1359*58b9f456SAndroid Build Coastguard Worker    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
1360*58b9f456SAndroid Build Coastguard Worker}
1361*58b9f456SAndroid Build Coastguard Worker
1362*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
1363*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1364*58b9f456SAndroid Build Coastguard Workerbool
1365*58b9f456SAndroid Build Coastguard Workeroperator!=(const multiset<_Key, _Compare, _Allocator>& __x,
1366*58b9f456SAndroid Build Coastguard Worker           const multiset<_Key, _Compare, _Allocator>& __y)
1367*58b9f456SAndroid Build Coastguard Worker{
1368*58b9f456SAndroid Build Coastguard Worker    return !(__x == __y);
1369*58b9f456SAndroid Build Coastguard Worker}
1370*58b9f456SAndroid Build Coastguard Worker
1371*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
1372*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1373*58b9f456SAndroid Build Coastguard Workerbool
1374*58b9f456SAndroid Build Coastguard Workeroperator> (const multiset<_Key, _Compare, _Allocator>& __x,
1375*58b9f456SAndroid Build Coastguard Worker           const multiset<_Key, _Compare, _Allocator>& __y)
1376*58b9f456SAndroid Build Coastguard Worker{
1377*58b9f456SAndroid Build Coastguard Worker    return __y < __x;
1378*58b9f456SAndroid Build Coastguard Worker}
1379*58b9f456SAndroid Build Coastguard Worker
1380*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
1381*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1382*58b9f456SAndroid Build Coastguard Workerbool
1383*58b9f456SAndroid Build Coastguard Workeroperator>=(const multiset<_Key, _Compare, _Allocator>& __x,
1384*58b9f456SAndroid Build Coastguard Worker           const multiset<_Key, _Compare, _Allocator>& __y)
1385*58b9f456SAndroid Build Coastguard Worker{
1386*58b9f456SAndroid Build Coastguard Worker    return !(__x < __y);
1387*58b9f456SAndroid Build Coastguard Worker}
1388*58b9f456SAndroid Build Coastguard Worker
1389*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
1390*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1391*58b9f456SAndroid Build Coastguard Workerbool
1392*58b9f456SAndroid Build Coastguard Workeroperator<=(const multiset<_Key, _Compare, _Allocator>& __x,
1393*58b9f456SAndroid Build Coastguard Worker           const multiset<_Key, _Compare, _Allocator>& __y)
1394*58b9f456SAndroid Build Coastguard Worker{
1395*58b9f456SAndroid Build Coastguard Worker    return !(__y < __x);
1396*58b9f456SAndroid Build Coastguard Worker}
1397*58b9f456SAndroid Build Coastguard Worker
1398*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator>
1399*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1400*58b9f456SAndroid Build Coastguard Workervoid
1401*58b9f456SAndroid Build Coastguard Workerswap(multiset<_Key, _Compare, _Allocator>& __x,
1402*58b9f456SAndroid Build Coastguard Worker     multiset<_Key, _Compare, _Allocator>& __y)
1403*58b9f456SAndroid Build Coastguard Worker    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
1404*58b9f456SAndroid Build Coastguard Worker{
1405*58b9f456SAndroid Build Coastguard Worker    __x.swap(__y);
1406*58b9f456SAndroid Build Coastguard Worker}
1407*58b9f456SAndroid Build Coastguard Worker
1408*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 17
1409*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Compare, class _Allocator, class _Predicate>
1410*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1411*58b9f456SAndroid Build Coastguard Workervoid erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred)
1412*58b9f456SAndroid Build Coastguard Worker{ __libcpp_erase_if_container(__c, __pred); }
1413*58b9f456SAndroid Build Coastguard Worker#endif
1414*58b9f456SAndroid Build Coastguard Worker
1415*58b9f456SAndroid Build Coastguard Worker_LIBCPP_END_NAMESPACE_STD
1416*58b9f456SAndroid Build Coastguard Worker
1417*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_SET
1418