xref: /aosp_15_r20/external/libcxx/include/map (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1*58b9f456SAndroid Build Coastguard Worker// -*- C++ -*-
2*58b9f456SAndroid Build Coastguard Worker//===----------------------------- map ------------------------------------===//
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_MAP
12*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_MAP
13*58b9f456SAndroid Build Coastguard Worker
14*58b9f456SAndroid Build Coastguard Worker/*
15*58b9f456SAndroid Build Coastguard Worker
16*58b9f456SAndroid Build Coastguard Worker    map 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 T, class Compare = less<Key>,
22*58b9f456SAndroid Build Coastguard Worker          class Allocator = allocator<pair<const Key, T>>>
23*58b9f456SAndroid Build Coastguard Workerclass map
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 T                                        mapped_type;
29*58b9f456SAndroid Build Coastguard Worker    typedef pair<const key_type, mapped_type>        value_type;
30*58b9f456SAndroid Build Coastguard Worker    typedef Compare                                  key_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::pointer         pointer;
35*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::const_pointer   const_pointer;
36*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::size_type       size_type;
37*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::difference_type difference_type;
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    class value_compare
47*58b9f456SAndroid Build Coastguard Worker        : public binary_function<value_type, value_type, bool>
48*58b9f456SAndroid Build Coastguard Worker    {
49*58b9f456SAndroid Build Coastguard Worker        friend class map;
50*58b9f456SAndroid Build Coastguard Worker    protected:
51*58b9f456SAndroid Build Coastguard Worker        key_compare comp;
52*58b9f456SAndroid Build Coastguard Worker
53*58b9f456SAndroid Build Coastguard Worker        value_compare(key_compare c);
54*58b9f456SAndroid Build Coastguard Worker    public:
55*58b9f456SAndroid Build Coastguard Worker        bool operator()(const value_type& x, const value_type& y) const;
56*58b9f456SAndroid Build Coastguard Worker    };
57*58b9f456SAndroid Build Coastguard Worker
58*58b9f456SAndroid Build Coastguard Worker    // construct/copy/destroy:
59*58b9f456SAndroid Build Coastguard Worker    map()
60*58b9f456SAndroid Build Coastguard Worker        noexcept(
61*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
62*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<key_compare>::value &&
63*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value);
64*58b9f456SAndroid Build Coastguard Worker    explicit map(const key_compare& comp);
65*58b9f456SAndroid Build Coastguard Worker    map(const key_compare& comp, const allocator_type& a);
66*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
67*58b9f456SAndroid Build Coastguard Worker        map(InputIterator first, InputIterator last,
68*58b9f456SAndroid Build Coastguard Worker            const key_compare& comp = key_compare());
69*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
70*58b9f456SAndroid Build Coastguard Worker        map(InputIterator first, InputIterator last,
71*58b9f456SAndroid Build Coastguard Worker            const key_compare& comp, const allocator_type& a);
72*58b9f456SAndroid Build Coastguard Worker    map(const map& m);
73*58b9f456SAndroid Build Coastguard Worker    map(map&& m)
74*58b9f456SAndroid Build Coastguard Worker        noexcept(
75*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_constructible<allocator_type>::value &&
76*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_constructible<key_compare>::value);
77*58b9f456SAndroid Build Coastguard Worker    explicit map(const allocator_type& a);
78*58b9f456SAndroid Build Coastguard Worker    map(const map& m, const allocator_type& a);
79*58b9f456SAndroid Build Coastguard Worker    map(map&& m, const allocator_type& a);
80*58b9f456SAndroid Build Coastguard Worker    map(initializer_list<value_type> il, const key_compare& comp = key_compare());
81*58b9f456SAndroid Build Coastguard Worker    map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
82*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
83*58b9f456SAndroid Build Coastguard Worker        map(InputIterator first, InputIterator last, const allocator_type& a)
84*58b9f456SAndroid Build Coastguard Worker            : map(first, last, Compare(), a) {}  // C++14
85*58b9f456SAndroid Build Coastguard Worker    map(initializer_list<value_type> il, const allocator_type& a)
86*58b9f456SAndroid Build Coastguard Worker        : map(il, Compare(), a) {}  // C++14
87*58b9f456SAndroid Build Coastguard Worker   ~map();
88*58b9f456SAndroid Build Coastguard Worker
89*58b9f456SAndroid Build Coastguard Worker    map& operator=(const map& m);
90*58b9f456SAndroid Build Coastguard Worker    map& operator=(map&& m)
91*58b9f456SAndroid Build Coastguard Worker        noexcept(
92*58b9f456SAndroid Build Coastguard Worker            allocator_type::propagate_on_container_move_assignment::value &&
93*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_assignable<allocator_type>::value &&
94*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_assignable<key_compare>::value);
95*58b9f456SAndroid Build Coastguard Worker    map& operator=(initializer_list<value_type> il);
96*58b9f456SAndroid Build Coastguard Worker
97*58b9f456SAndroid Build Coastguard Worker    // iterators:
98*58b9f456SAndroid Build Coastguard Worker          iterator begin() noexcept;
99*58b9f456SAndroid Build Coastguard Worker    const_iterator begin() const noexcept;
100*58b9f456SAndroid Build Coastguard Worker          iterator end() noexcept;
101*58b9f456SAndroid Build Coastguard Worker    const_iterator end()   const noexcept;
102*58b9f456SAndroid Build Coastguard Worker
103*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rbegin() noexcept;
104*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rbegin() const noexcept;
105*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rend() noexcept;
106*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rend()   const noexcept;
107*58b9f456SAndroid Build Coastguard Worker
108*58b9f456SAndroid Build Coastguard Worker    const_iterator         cbegin()  const noexcept;
109*58b9f456SAndroid Build Coastguard Worker    const_iterator         cend()    const noexcept;
110*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crbegin() const noexcept;
111*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crend()   const noexcept;
112*58b9f456SAndroid Build Coastguard Worker
113*58b9f456SAndroid Build Coastguard Worker    // capacity:
114*58b9f456SAndroid Build Coastguard Worker    bool      empty()    const noexcept;
115*58b9f456SAndroid Build Coastguard Worker    size_type size()     const noexcept;
116*58b9f456SAndroid Build Coastguard Worker    size_type max_size() const noexcept;
117*58b9f456SAndroid Build Coastguard Worker
118*58b9f456SAndroid Build Coastguard Worker    // element access:
119*58b9f456SAndroid Build Coastguard Worker    mapped_type& operator[](const key_type& k);
120*58b9f456SAndroid Build Coastguard Worker    mapped_type& operator[](key_type&& k);
121*58b9f456SAndroid Build Coastguard Worker
122*58b9f456SAndroid Build Coastguard Worker          mapped_type& at(const key_type& k);
123*58b9f456SAndroid Build Coastguard Worker    const mapped_type& at(const key_type& k) const;
124*58b9f456SAndroid Build Coastguard Worker
125*58b9f456SAndroid Build Coastguard Worker    // modifiers:
126*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
127*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> emplace(Args&&... args);
128*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
129*58b9f456SAndroid Build Coastguard Worker        iterator emplace_hint(const_iterator position, Args&&... args);
130*58b9f456SAndroid Build Coastguard Worker    pair<iterator, bool> insert(const value_type& v);
131*58b9f456SAndroid Build Coastguard Worker    pair<iterator, bool> insert(      value_type&& v);                                // C++17
132*58b9f456SAndroid Build Coastguard Worker    template <class P>
133*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> insert(P&& p);
134*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator position, const value_type& v);
135*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator position,       value_type&& v);                   // C++17
136*58b9f456SAndroid Build Coastguard Worker    template <class P>
137*58b9f456SAndroid Build Coastguard Worker        iterator insert(const_iterator position, P&& p);
138*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
139*58b9f456SAndroid Build Coastguard Worker        void insert(InputIterator first, InputIterator last);
140*58b9f456SAndroid Build Coastguard Worker    void insert(initializer_list<value_type> il);
141*58b9f456SAndroid Build Coastguard Worker
142*58b9f456SAndroid Build Coastguard Worker    node_type extract(const_iterator position);                                       // C++17
143*58b9f456SAndroid Build Coastguard Worker    node_type extract(const key_type& x);                                             // C++17
144*58b9f456SAndroid Build Coastguard Worker    insert_return_type insert(node_type&& nh);                                        // C++17
145*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator hint, node_type&& nh);                             // C++17
146*58b9f456SAndroid Build Coastguard Worker
147*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
148*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);          // C++17
149*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
150*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);               // C++17
151*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
152*58b9f456SAndroid Build Coastguard Worker        iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17
153*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
154*58b9f456SAndroid Build Coastguard Worker        iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);      // C++17
155*58b9f456SAndroid Build Coastguard Worker    template <class M>
156*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);            // C++17
157*58b9f456SAndroid Build Coastguard Worker    template <class M>
158*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);                 // C++17
159*58b9f456SAndroid Build Coastguard Worker    template <class M>
160*58b9f456SAndroid Build Coastguard Worker        iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);   // C++17
161*58b9f456SAndroid Build Coastguard Worker    template <class M>
162*58b9f456SAndroid Build Coastguard Worker        iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);        // C++17
163*58b9f456SAndroid Build Coastguard Worker
164*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator position);
165*58b9f456SAndroid Build Coastguard Worker    iterator  erase(iterator position); // C++14
166*58b9f456SAndroid Build Coastguard Worker    size_type erase(const key_type& k);
167*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator first, const_iterator last);
168*58b9f456SAndroid Build Coastguard Worker    void clear() noexcept;
169*58b9f456SAndroid Build Coastguard Worker
170*58b9f456SAndroid Build Coastguard Worker    template<class C2>
171*58b9f456SAndroid Build Coastguard Worker      void merge(map<Key, T, C2, Allocator>& source);         // C++17
172*58b9f456SAndroid Build Coastguard Worker    template<class C2>
173*58b9f456SAndroid Build Coastguard Worker      void merge(map<Key, T, C2, Allocator>&& source);        // C++17
174*58b9f456SAndroid Build Coastguard Worker    template<class C2>
175*58b9f456SAndroid Build Coastguard Worker      void merge(multimap<Key, T, C2, Allocator>& source);    // C++17
176*58b9f456SAndroid Build Coastguard Worker    template<class C2>
177*58b9f456SAndroid Build Coastguard Worker      void merge(multimap<Key, T, C2, Allocator>&& source);   // C++17
178*58b9f456SAndroid Build Coastguard Worker
179*58b9f456SAndroid Build Coastguard Worker    void swap(map& m)
180*58b9f456SAndroid Build Coastguard Worker        noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
181*58b9f456SAndroid Build Coastguard Worker            is_nothrow_swappable<key_compare>::value); // C++17
182*58b9f456SAndroid Build Coastguard Worker
183*58b9f456SAndroid Build Coastguard Worker    // observers:
184*58b9f456SAndroid Build Coastguard Worker    allocator_type get_allocator() const noexcept;
185*58b9f456SAndroid Build Coastguard Worker    key_compare    key_comp()      const;
186*58b9f456SAndroid Build Coastguard Worker    value_compare  value_comp()    const;
187*58b9f456SAndroid Build Coastguard Worker
188*58b9f456SAndroid Build Coastguard Worker    // map operations:
189*58b9f456SAndroid Build Coastguard Worker          iterator find(const key_type& k);
190*58b9f456SAndroid Build Coastguard Worker    const_iterator find(const key_type& k) const;
191*58b9f456SAndroid Build Coastguard Worker    template<typename K>
192*58b9f456SAndroid Build Coastguard Worker        iterator find(const K& x);              // C++14
193*58b9f456SAndroid Build Coastguard Worker    template<typename K>
194*58b9f456SAndroid Build Coastguard Worker        const_iterator find(const K& x) const;  // C++14
195*58b9f456SAndroid Build Coastguard Worker    template<typename K>
196*58b9f456SAndroid Build Coastguard Worker      size_type count(const K& x) const;        // C++14
197*58b9f456SAndroid Build Coastguard Worker
198*58b9f456SAndroid Build Coastguard Worker    size_type      count(const key_type& k) const;
199*58b9f456SAndroid Build Coastguard Worker          iterator lower_bound(const key_type& k);
200*58b9f456SAndroid Build Coastguard Worker    const_iterator lower_bound(const key_type& k) const;
201*58b9f456SAndroid Build Coastguard Worker    template<typename K>
202*58b9f456SAndroid Build Coastguard Worker        iterator lower_bound(const K& x);              // C++14
203*58b9f456SAndroid Build Coastguard Worker    template<typename K>
204*58b9f456SAndroid Build Coastguard Worker        const_iterator lower_bound(const K& x) const;  // C++14
205*58b9f456SAndroid Build Coastguard Worker
206*58b9f456SAndroid Build Coastguard Worker          iterator upper_bound(const key_type& k);
207*58b9f456SAndroid Build Coastguard Worker    const_iterator upper_bound(const key_type& k) const;
208*58b9f456SAndroid Build Coastguard Worker    template<typename K>
209*58b9f456SAndroid Build Coastguard Worker        iterator upper_bound(const K& x);              // C++14
210*58b9f456SAndroid Build Coastguard Worker    template<typename K>
211*58b9f456SAndroid Build Coastguard Worker        const_iterator upper_bound(const K& x) const;  // C++14
212*58b9f456SAndroid Build Coastguard Worker
213*58b9f456SAndroid Build Coastguard Worker    pair<iterator,iterator>             equal_range(const key_type& k);
214*58b9f456SAndroid Build Coastguard Worker    pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
215*58b9f456SAndroid Build Coastguard Worker    template<typename K>
216*58b9f456SAndroid Build Coastguard Worker        pair<iterator,iterator>             equal_range(const K& x);        // C++14
217*58b9f456SAndroid Build Coastguard Worker    template<typename K>
218*58b9f456SAndroid Build Coastguard Worker        pair<const_iterator,const_iterator> equal_range(const K& x) const;  // C++14
219*58b9f456SAndroid Build Coastguard Worker};
220*58b9f456SAndroid Build Coastguard Worker
221*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
222*58b9f456SAndroid Build Coastguard Workerbool
223*58b9f456SAndroid Build Coastguard Workeroperator==(const map<Key, T, Compare, Allocator>& x,
224*58b9f456SAndroid Build Coastguard Worker           const map<Key, T, Compare, Allocator>& y);
225*58b9f456SAndroid Build Coastguard Worker
226*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
227*58b9f456SAndroid Build Coastguard Workerbool
228*58b9f456SAndroid Build Coastguard Workeroperator< (const map<Key, T, Compare, Allocator>& x,
229*58b9f456SAndroid Build Coastguard Worker           const map<Key, T, Compare, Allocator>& y);
230*58b9f456SAndroid Build Coastguard Worker
231*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
232*58b9f456SAndroid Build Coastguard Workerbool
233*58b9f456SAndroid Build Coastguard Workeroperator!=(const map<Key, T, Compare, Allocator>& x,
234*58b9f456SAndroid Build Coastguard Worker           const map<Key, T, Compare, Allocator>& y);
235*58b9f456SAndroid Build Coastguard Worker
236*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
237*58b9f456SAndroid Build Coastguard Workerbool
238*58b9f456SAndroid Build Coastguard Workeroperator> (const map<Key, T, Compare, Allocator>& x,
239*58b9f456SAndroid Build Coastguard Worker           const map<Key, T, Compare, Allocator>& y);
240*58b9f456SAndroid Build Coastguard Worker
241*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
242*58b9f456SAndroid Build Coastguard Workerbool
243*58b9f456SAndroid Build Coastguard Workeroperator>=(const map<Key, T, Compare, Allocator>& x,
244*58b9f456SAndroid Build Coastguard Worker           const map<Key, T, Compare, Allocator>& y);
245*58b9f456SAndroid Build Coastguard Worker
246*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
247*58b9f456SAndroid Build Coastguard Workerbool
248*58b9f456SAndroid Build Coastguard Workeroperator<=(const map<Key, T, Compare, Allocator>& x,
249*58b9f456SAndroid Build Coastguard Worker           const map<Key, T, Compare, Allocator>& y);
250*58b9f456SAndroid Build Coastguard Worker
251*58b9f456SAndroid Build Coastguard Worker// specialized algorithms:
252*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
253*58b9f456SAndroid Build Coastguard Workervoid
254*58b9f456SAndroid Build Coastguard Workerswap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y)
255*58b9f456SAndroid Build Coastguard Worker    noexcept(noexcept(x.swap(y)));
256*58b9f456SAndroid Build Coastguard Worker
257*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator, class Predicate>
258*58b9f456SAndroid Build Coastguard Worker  void erase_if(map<Key, T, Compare, Allocator>& c, Predicate pred);  // C++20
259*58b9f456SAndroid Build Coastguard Worker
260*58b9f456SAndroid Build Coastguard Worker
261*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare = less<Key>,
262*58b9f456SAndroid Build Coastguard Worker          class Allocator = allocator<pair<const Key, T>>>
263*58b9f456SAndroid Build Coastguard Workerclass multimap
264*58b9f456SAndroid Build Coastguard Worker{
265*58b9f456SAndroid Build Coastguard Workerpublic:
266*58b9f456SAndroid Build Coastguard Worker    // types:
267*58b9f456SAndroid Build Coastguard Worker    typedef Key                                      key_type;
268*58b9f456SAndroid Build Coastguard Worker    typedef T                                        mapped_type;
269*58b9f456SAndroid Build Coastguard Worker    typedef pair<const key_type,mapped_type>         value_type;
270*58b9f456SAndroid Build Coastguard Worker    typedef Compare                                  key_compare;
271*58b9f456SAndroid Build Coastguard Worker    typedef Allocator                                allocator_type;
272*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::reference       reference;
273*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::const_reference const_reference;
274*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::size_type       size_type;
275*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::difference_type difference_type;
276*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::pointer         pointer;
277*58b9f456SAndroid Build Coastguard Worker    typedef typename allocator_type::const_pointer   const_pointer;
278*58b9f456SAndroid Build Coastguard Worker
279*58b9f456SAndroid Build Coastguard Worker    typedef implementation-defined                   iterator;
280*58b9f456SAndroid Build Coastguard Worker    typedef implementation-defined                   const_iterator;
281*58b9f456SAndroid Build Coastguard Worker    typedef std::reverse_iterator<iterator>          reverse_iterator;
282*58b9f456SAndroid Build Coastguard Worker    typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
283*58b9f456SAndroid Build Coastguard Worker    typedef unspecified                              node_type;              // C++17
284*58b9f456SAndroid Build Coastguard Worker
285*58b9f456SAndroid Build Coastguard Worker    class value_compare
286*58b9f456SAndroid Build Coastguard Worker        : public binary_function<value_type,value_type,bool>
287*58b9f456SAndroid Build Coastguard Worker    {
288*58b9f456SAndroid Build Coastguard Worker        friend class multimap;
289*58b9f456SAndroid Build Coastguard Worker    protected:
290*58b9f456SAndroid Build Coastguard Worker        key_compare comp;
291*58b9f456SAndroid Build Coastguard Worker        value_compare(key_compare c);
292*58b9f456SAndroid Build Coastguard Worker    public:
293*58b9f456SAndroid Build Coastguard Worker        bool operator()(const value_type& x, const value_type& y) const;
294*58b9f456SAndroid Build Coastguard Worker    };
295*58b9f456SAndroid Build Coastguard Worker
296*58b9f456SAndroid Build Coastguard Worker    // construct/copy/destroy:
297*58b9f456SAndroid Build Coastguard Worker    multimap()
298*58b9f456SAndroid Build Coastguard Worker        noexcept(
299*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
300*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<key_compare>::value &&
301*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value);
302*58b9f456SAndroid Build Coastguard Worker    explicit multimap(const key_compare& comp);
303*58b9f456SAndroid Build Coastguard Worker    multimap(const key_compare& comp, const allocator_type& a);
304*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
305*58b9f456SAndroid Build Coastguard Worker        multimap(InputIterator first, InputIterator last, const key_compare& comp);
306*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
307*58b9f456SAndroid Build Coastguard Worker        multimap(InputIterator first, InputIterator last, const key_compare& comp,
308*58b9f456SAndroid Build Coastguard Worker                 const allocator_type& a);
309*58b9f456SAndroid Build Coastguard Worker    multimap(const multimap& m);
310*58b9f456SAndroid Build Coastguard Worker    multimap(multimap&& m)
311*58b9f456SAndroid Build Coastguard Worker        noexcept(
312*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_constructible<allocator_type>::value &&
313*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_constructible<key_compare>::value);
314*58b9f456SAndroid Build Coastguard Worker    explicit multimap(const allocator_type& a);
315*58b9f456SAndroid Build Coastguard Worker    multimap(const multimap& m, const allocator_type& a);
316*58b9f456SAndroid Build Coastguard Worker    multimap(multimap&& m, const allocator_type& a);
317*58b9f456SAndroid Build Coastguard Worker    multimap(initializer_list<value_type> il, const key_compare& comp = key_compare());
318*58b9f456SAndroid Build Coastguard Worker    multimap(initializer_list<value_type> il, const key_compare& comp,
319*58b9f456SAndroid Build Coastguard Worker             const allocator_type& a);
320*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
321*58b9f456SAndroid Build Coastguard Worker        multimap(InputIterator first, InputIterator last, const allocator_type& a)
322*58b9f456SAndroid Build Coastguard Worker            : multimap(first, last, Compare(), a) {} // C++14
323*58b9f456SAndroid Build Coastguard Worker    multimap(initializer_list<value_type> il, const allocator_type& a)
324*58b9f456SAndroid Build Coastguard Worker        : multimap(il, Compare(), a) {} // C++14
325*58b9f456SAndroid Build Coastguard Worker    ~multimap();
326*58b9f456SAndroid Build Coastguard Worker
327*58b9f456SAndroid Build Coastguard Worker    multimap& operator=(const multimap& m);
328*58b9f456SAndroid Build Coastguard Worker    multimap& operator=(multimap&& m)
329*58b9f456SAndroid Build Coastguard Worker        noexcept(
330*58b9f456SAndroid Build Coastguard Worker            allocator_type::propagate_on_container_move_assignment::value &&
331*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_assignable<allocator_type>::value &&
332*58b9f456SAndroid Build Coastguard Worker            is_nothrow_move_assignable<key_compare>::value);
333*58b9f456SAndroid Build Coastguard Worker    multimap& operator=(initializer_list<value_type> il);
334*58b9f456SAndroid Build Coastguard Worker
335*58b9f456SAndroid Build Coastguard Worker    // iterators:
336*58b9f456SAndroid Build Coastguard Worker          iterator begin() noexcept;
337*58b9f456SAndroid Build Coastguard Worker    const_iterator begin() const noexcept;
338*58b9f456SAndroid Build Coastguard Worker          iterator end() noexcept;
339*58b9f456SAndroid Build Coastguard Worker    const_iterator end()   const noexcept;
340*58b9f456SAndroid Build Coastguard Worker
341*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rbegin() noexcept;
342*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rbegin() const noexcept;
343*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rend() noexcept;
344*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rend()   const noexcept;
345*58b9f456SAndroid Build Coastguard Worker
346*58b9f456SAndroid Build Coastguard Worker    const_iterator         cbegin()  const noexcept;
347*58b9f456SAndroid Build Coastguard Worker    const_iterator         cend()    const noexcept;
348*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crbegin() const noexcept;
349*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crend()   const noexcept;
350*58b9f456SAndroid Build Coastguard Worker
351*58b9f456SAndroid Build Coastguard Worker    // capacity:
352*58b9f456SAndroid Build Coastguard Worker    bool      empty()    const noexcept;
353*58b9f456SAndroid Build Coastguard Worker    size_type size()     const noexcept;
354*58b9f456SAndroid Build Coastguard Worker    size_type max_size() const noexcept;
355*58b9f456SAndroid Build Coastguard Worker
356*58b9f456SAndroid Build Coastguard Worker    // modifiers:
357*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
358*58b9f456SAndroid Build Coastguard Worker        iterator emplace(Args&&... args);
359*58b9f456SAndroid Build Coastguard Worker    template <class... Args>
360*58b9f456SAndroid Build Coastguard Worker        iterator emplace_hint(const_iterator position, Args&&... args);
361*58b9f456SAndroid Build Coastguard Worker    iterator insert(const value_type& v);
362*58b9f456SAndroid Build Coastguard Worker    iterator insert(      value_type&& v);                                            // C++17
363*58b9f456SAndroid Build Coastguard Worker    template <class P>
364*58b9f456SAndroid Build Coastguard Worker        iterator insert(P&& p);
365*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator position, const value_type& v);
366*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator position,       value_type&& v);                   // C++17
367*58b9f456SAndroid Build Coastguard Worker    template <class P>
368*58b9f456SAndroid Build Coastguard Worker        iterator insert(const_iterator position, P&& p);
369*58b9f456SAndroid Build Coastguard Worker    template <class InputIterator>
370*58b9f456SAndroid Build Coastguard Worker        void insert(InputIterator first, InputIterator last);
371*58b9f456SAndroid Build Coastguard Worker    void insert(initializer_list<value_type> il);
372*58b9f456SAndroid Build Coastguard Worker
373*58b9f456SAndroid Build Coastguard Worker    node_type extract(const_iterator position);                                       // C++17
374*58b9f456SAndroid Build Coastguard Worker    node_type extract(const key_type& x);                                             // C++17
375*58b9f456SAndroid Build Coastguard Worker    iterator insert(node_type&& nh);                                                  // C++17
376*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator hint, node_type&& nh);                             // C++17
377*58b9f456SAndroid Build Coastguard Worker
378*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator position);
379*58b9f456SAndroid Build Coastguard Worker    iterator  erase(iterator position); // C++14
380*58b9f456SAndroid Build Coastguard Worker    size_type erase(const key_type& k);
381*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator first, const_iterator last);
382*58b9f456SAndroid Build Coastguard Worker    void clear() noexcept;
383*58b9f456SAndroid Build Coastguard Worker
384*58b9f456SAndroid Build Coastguard Worker    template<class C2>
385*58b9f456SAndroid Build Coastguard Worker      void merge(multimap<Key, T, C2, Allocator>& source);    // C++17
386*58b9f456SAndroid Build Coastguard Worker    template<class C2>
387*58b9f456SAndroid Build Coastguard Worker      void merge(multimap<Key, T, C2, Allocator>&& source);   // C++17
388*58b9f456SAndroid Build Coastguard Worker    template<class C2>
389*58b9f456SAndroid Build Coastguard Worker      void merge(map<Key, T, C2, Allocator>& source);         // C++17
390*58b9f456SAndroid Build Coastguard Worker    template<class C2>
391*58b9f456SAndroid Build Coastguard Worker      void merge(map<Key, T, C2, Allocator>&& source);        // C++17
392*58b9f456SAndroid Build Coastguard Worker
393*58b9f456SAndroid Build Coastguard Worker    void swap(multimap& m)
394*58b9f456SAndroid Build Coastguard Worker        noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
395*58b9f456SAndroid Build Coastguard Worker            is_nothrow_swappable<key_compare>::value); // C++17
396*58b9f456SAndroid Build Coastguard Worker
397*58b9f456SAndroid Build Coastguard Worker    // observers:
398*58b9f456SAndroid Build Coastguard Worker    allocator_type get_allocator() const noexcept;
399*58b9f456SAndroid Build Coastguard Worker    key_compare    key_comp()      const;
400*58b9f456SAndroid Build Coastguard Worker    value_compare  value_comp()    const;
401*58b9f456SAndroid Build Coastguard Worker
402*58b9f456SAndroid Build Coastguard Worker    // map operations:
403*58b9f456SAndroid Build Coastguard Worker          iterator find(const key_type& k);
404*58b9f456SAndroid Build Coastguard Worker    const_iterator find(const key_type& k) const;
405*58b9f456SAndroid Build Coastguard Worker    template<typename K>
406*58b9f456SAndroid Build Coastguard Worker        iterator find(const K& x);              // C++14
407*58b9f456SAndroid Build Coastguard Worker    template<typename K>
408*58b9f456SAndroid Build Coastguard Worker        const_iterator find(const K& x) const;  // C++14
409*58b9f456SAndroid Build Coastguard Worker    template<typename K>
410*58b9f456SAndroid Build Coastguard Worker      size_type count(const K& x) const;        // C++14
411*58b9f456SAndroid Build Coastguard Worker
412*58b9f456SAndroid Build Coastguard Worker    size_type      count(const key_type& k) const;
413*58b9f456SAndroid Build Coastguard Worker          iterator lower_bound(const key_type& k);
414*58b9f456SAndroid Build Coastguard Worker    const_iterator lower_bound(const key_type& k) const;
415*58b9f456SAndroid Build Coastguard Worker    template<typename K>
416*58b9f456SAndroid Build Coastguard Worker        iterator lower_bound(const K& x);              // C++14
417*58b9f456SAndroid Build Coastguard Worker    template<typename K>
418*58b9f456SAndroid Build Coastguard Worker        const_iterator lower_bound(const K& x) const;  // C++14
419*58b9f456SAndroid Build Coastguard Worker
420*58b9f456SAndroid Build Coastguard Worker          iterator upper_bound(const key_type& k);
421*58b9f456SAndroid Build Coastguard Worker    const_iterator upper_bound(const key_type& k) const;
422*58b9f456SAndroid Build Coastguard Worker    template<typename K>
423*58b9f456SAndroid Build Coastguard Worker        iterator upper_bound(const K& x);              // C++14
424*58b9f456SAndroid Build Coastguard Worker    template<typename K>
425*58b9f456SAndroid Build Coastguard Worker        const_iterator upper_bound(const K& x) const;  // C++14
426*58b9f456SAndroid Build Coastguard Worker
427*58b9f456SAndroid Build Coastguard Worker    pair<iterator,iterator>             equal_range(const key_type& k);
428*58b9f456SAndroid Build Coastguard Worker    pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
429*58b9f456SAndroid Build Coastguard Worker    template<typename K>
430*58b9f456SAndroid Build Coastguard Worker        pair<iterator,iterator>             equal_range(const K& x);        // C++14
431*58b9f456SAndroid Build Coastguard Worker    template<typename K>
432*58b9f456SAndroid Build Coastguard Worker        pair<const_iterator,const_iterator> equal_range(const K& x) const;  // C++14
433*58b9f456SAndroid Build Coastguard Worker};
434*58b9f456SAndroid Build Coastguard Worker
435*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
436*58b9f456SAndroid Build Coastguard Workerbool
437*58b9f456SAndroid Build Coastguard Workeroperator==(const multimap<Key, T, Compare, Allocator>& x,
438*58b9f456SAndroid Build Coastguard Worker           const multimap<Key, T, Compare, Allocator>& y);
439*58b9f456SAndroid Build Coastguard Worker
440*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
441*58b9f456SAndroid Build Coastguard Workerbool
442*58b9f456SAndroid Build Coastguard Workeroperator< (const multimap<Key, T, Compare, Allocator>& x,
443*58b9f456SAndroid Build Coastguard Worker           const multimap<Key, T, Compare, Allocator>& y);
444*58b9f456SAndroid Build Coastguard Worker
445*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
446*58b9f456SAndroid Build Coastguard Workerbool
447*58b9f456SAndroid Build Coastguard Workeroperator!=(const multimap<Key, T, Compare, Allocator>& x,
448*58b9f456SAndroid Build Coastguard Worker           const multimap<Key, T, Compare, Allocator>& y);
449*58b9f456SAndroid Build Coastguard Worker
450*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
451*58b9f456SAndroid Build Coastguard Workerbool
452*58b9f456SAndroid Build Coastguard Workeroperator> (const multimap<Key, T, Compare, Allocator>& x,
453*58b9f456SAndroid Build Coastguard Worker           const multimap<Key, T, Compare, Allocator>& y);
454*58b9f456SAndroid Build Coastguard Worker
455*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
456*58b9f456SAndroid Build Coastguard Workerbool
457*58b9f456SAndroid Build Coastguard Workeroperator>=(const multimap<Key, T, Compare, Allocator>& x,
458*58b9f456SAndroid Build Coastguard Worker           const multimap<Key, T, Compare, Allocator>& y);
459*58b9f456SAndroid Build Coastguard Worker
460*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
461*58b9f456SAndroid Build Coastguard Workerbool
462*58b9f456SAndroid Build Coastguard Workeroperator<=(const multimap<Key, T, Compare, Allocator>& x,
463*58b9f456SAndroid Build Coastguard Worker           const multimap<Key, T, Compare, Allocator>& y);
464*58b9f456SAndroid Build Coastguard Worker
465*58b9f456SAndroid Build Coastguard Worker// specialized algorithms:
466*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator>
467*58b9f456SAndroid Build Coastguard Workervoid
468*58b9f456SAndroid Build Coastguard Workerswap(multimap<Key, T, Compare, Allocator>& x,
469*58b9f456SAndroid Build Coastguard Worker     multimap<Key, T, Compare, Allocator>& y)
470*58b9f456SAndroid Build Coastguard Worker    noexcept(noexcept(x.swap(y)));
471*58b9f456SAndroid Build Coastguard Worker
472*58b9f456SAndroid Build Coastguard Workertemplate <class Key, class T, class Compare, class Allocator, class Predicate>
473*58b9f456SAndroid Build Coastguard Worker  void erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred);  // C++20
474*58b9f456SAndroid Build Coastguard Worker
475*58b9f456SAndroid Build Coastguard Worker}  // std
476*58b9f456SAndroid Build Coastguard Worker
477*58b9f456SAndroid Build Coastguard Worker*/
478*58b9f456SAndroid Build Coastguard Worker
479*58b9f456SAndroid Build Coastguard Worker#include <__config>
480*58b9f456SAndroid Build Coastguard Worker#include <__tree>
481*58b9f456SAndroid Build Coastguard Worker#include <__node_handle>
482*58b9f456SAndroid Build Coastguard Worker#include <iterator>
483*58b9f456SAndroid Build Coastguard Worker#include <memory>
484*58b9f456SAndroid Build Coastguard Worker#include <utility>
485*58b9f456SAndroid Build Coastguard Worker#include <functional>
486*58b9f456SAndroid Build Coastguard Worker#include <initializer_list>
487*58b9f456SAndroid Build Coastguard Worker#include <type_traits>
488*58b9f456SAndroid Build Coastguard Worker#include <version>
489*58b9f456SAndroid Build Coastguard Worker
490*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
491*58b9f456SAndroid Build Coastguard Worker#pragma GCC system_header
492*58b9f456SAndroid Build Coastguard Worker#endif
493*58b9f456SAndroid Build Coastguard Worker
494*58b9f456SAndroid Build Coastguard Worker_LIBCPP_BEGIN_NAMESPACE_STD
495*58b9f456SAndroid Build Coastguard Worker
496*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _CP, class _Compare,
497*58b9f456SAndroid Build Coastguard Worker          bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value>
498*58b9f456SAndroid Build Coastguard Workerclass __map_value_compare
499*58b9f456SAndroid Build Coastguard Worker    : private _Compare
500*58b9f456SAndroid Build Coastguard Worker{
501*58b9f456SAndroid Build Coastguard Workerpublic:
502*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
503*58b9f456SAndroid Build Coastguard Worker    __map_value_compare()
504*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
505*58b9f456SAndroid Build Coastguard Worker        : _Compare() {}
506*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
507*58b9f456SAndroid Build Coastguard Worker    __map_value_compare(_Compare c)
508*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
509*58b9f456SAndroid Build Coastguard Worker        : _Compare(c) {}
510*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
511*58b9f456SAndroid Build Coastguard Worker    const _Compare& key_comp() const _NOEXCEPT {return *this;}
512*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
513*58b9f456SAndroid Build Coastguard Worker    bool operator()(const _CP& __x, const _CP& __y) const
514*58b9f456SAndroid Build Coastguard Worker        {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y.__get_value().first);}
515*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
516*58b9f456SAndroid Build Coastguard Worker    bool operator()(const _CP& __x, const _Key& __y) const
517*58b9f456SAndroid Build Coastguard Worker        {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);}
518*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
519*58b9f456SAndroid Build Coastguard Worker    bool operator()(const _Key& __x, const _CP& __y) const
520*58b9f456SAndroid Build Coastguard Worker        {return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);}
521*58b9f456SAndroid Build Coastguard Worker    void swap(__map_value_compare&__y)
522*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
523*58b9f456SAndroid Build Coastguard Worker    {
524*58b9f456SAndroid Build Coastguard Worker      using _VSTD::swap;
525*58b9f456SAndroid Build Coastguard Worker      swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y));
526*58b9f456SAndroid Build Coastguard Worker    }
527*58b9f456SAndroid Build Coastguard Worker
528*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
529*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
530*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
531*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
532*58b9f456SAndroid Build Coastguard Worker    operator () ( const _K2& __x, const _CP& __y ) const
533*58b9f456SAndroid Build Coastguard Worker        {return static_cast<const _Compare&>(*this) (__x, __y.__get_value().first);}
534*58b9f456SAndroid Build Coastguard Worker
535*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
536*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
537*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
538*58b9f456SAndroid Build Coastguard Worker    operator () (const _CP& __x, const _K2& __y) const
539*58b9f456SAndroid Build Coastguard Worker        {return static_cast<const _Compare&>(*this) (__x.__get_value().first, __y);}
540*58b9f456SAndroid Build Coastguard Worker#endif
541*58b9f456SAndroid Build Coastguard Worker};
542*58b9f456SAndroid Build Coastguard Worker
543*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _CP, class _Compare>
544*58b9f456SAndroid Build Coastguard Workerclass __map_value_compare<_Key, _CP, _Compare, false>
545*58b9f456SAndroid Build Coastguard Worker{
546*58b9f456SAndroid Build Coastguard Worker    _Compare comp;
547*58b9f456SAndroid Build Coastguard Worker
548*58b9f456SAndroid Build Coastguard Workerpublic:
549*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
550*58b9f456SAndroid Build Coastguard Worker    __map_value_compare()
551*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
552*58b9f456SAndroid Build Coastguard Worker        : comp() {}
553*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
554*58b9f456SAndroid Build Coastguard Worker    __map_value_compare(_Compare c)
555*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
556*58b9f456SAndroid Build Coastguard Worker        : comp(c) {}
557*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
558*58b9f456SAndroid Build Coastguard Worker    const _Compare& key_comp() const _NOEXCEPT {return comp;}
559*58b9f456SAndroid Build Coastguard Worker
560*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
561*58b9f456SAndroid Build Coastguard Worker    bool operator()(const _CP& __x, const _CP& __y) const
562*58b9f456SAndroid Build Coastguard Worker        {return comp(__x.__get_value().first, __y.__get_value().first);}
563*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
564*58b9f456SAndroid Build Coastguard Worker    bool operator()(const _CP& __x, const _Key& __y) const
565*58b9f456SAndroid Build Coastguard Worker        {return comp(__x.__get_value().first, __y);}
566*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
567*58b9f456SAndroid Build Coastguard Worker    bool operator()(const _Key& __x, const _CP& __y) const
568*58b9f456SAndroid Build Coastguard Worker        {return comp(__x, __y.__get_value().first);}
569*58b9f456SAndroid Build Coastguard Worker    void swap(__map_value_compare&__y)
570*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
571*58b9f456SAndroid Build Coastguard Worker    {
572*58b9f456SAndroid Build Coastguard Worker        using _VSTD::swap;
573*58b9f456SAndroid Build Coastguard Worker        swap(comp, __y.comp);
574*58b9f456SAndroid Build Coastguard Worker    }
575*58b9f456SAndroid Build Coastguard Worker
576*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
577*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
578*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
579*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
580*58b9f456SAndroid Build Coastguard Worker    operator () ( const _K2& __x, const _CP& __y ) const
581*58b9f456SAndroid Build Coastguard Worker        {return comp (__x, __y.__get_value().first);}
582*58b9f456SAndroid Build Coastguard Worker
583*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
584*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
585*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
586*58b9f456SAndroid Build Coastguard Worker    operator () (const _CP& __x, const _K2& __y) const
587*58b9f456SAndroid Build Coastguard Worker        {return comp (__x.__get_value().first, __y);}
588*58b9f456SAndroid Build Coastguard Worker#endif
589*58b9f456SAndroid Build Coastguard Worker};
590*58b9f456SAndroid Build Coastguard Worker
591*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _CP, class _Compare, bool __b>
592*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
593*58b9f456SAndroid Build Coastguard Workervoid
594*58b9f456SAndroid Build Coastguard Workerswap(__map_value_compare<_Key, _CP, _Compare, __b>& __x,
595*58b9f456SAndroid Build Coastguard Worker     __map_value_compare<_Key, _CP, _Compare, __b>& __y)
596*58b9f456SAndroid Build Coastguard Worker    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
597*58b9f456SAndroid Build Coastguard Worker{
598*58b9f456SAndroid Build Coastguard Worker    __x.swap(__y);
599*58b9f456SAndroid Build Coastguard Worker}
600*58b9f456SAndroid Build Coastguard Worker
601*58b9f456SAndroid Build Coastguard Workertemplate <class _Allocator>
602*58b9f456SAndroid Build Coastguard Workerclass __map_node_destructor
603*58b9f456SAndroid Build Coastguard Worker{
604*58b9f456SAndroid Build Coastguard Worker    typedef _Allocator                          allocator_type;
605*58b9f456SAndroid Build Coastguard Worker    typedef allocator_traits<allocator_type>    __alloc_traits;
606*58b9f456SAndroid Build Coastguard Worker
607*58b9f456SAndroid Build Coastguard Workerpublic:
608*58b9f456SAndroid Build Coastguard Worker    typedef typename __alloc_traits::pointer    pointer;
609*58b9f456SAndroid Build Coastguard Worker
610*58b9f456SAndroid Build Coastguard Workerprivate:
611*58b9f456SAndroid Build Coastguard Worker    allocator_type& __na_;
612*58b9f456SAndroid Build Coastguard Worker
613*58b9f456SAndroid Build Coastguard Worker    __map_node_destructor& operator=(const __map_node_destructor&);
614*58b9f456SAndroid Build Coastguard Worker
615*58b9f456SAndroid Build Coastguard Workerpublic:
616*58b9f456SAndroid Build Coastguard Worker    bool __first_constructed;
617*58b9f456SAndroid Build Coastguard Worker    bool __second_constructed;
618*58b9f456SAndroid Build Coastguard Worker
619*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
620*58b9f456SAndroid Build Coastguard Worker    explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT
621*58b9f456SAndroid Build Coastguard Worker        : __na_(__na),
622*58b9f456SAndroid Build Coastguard Worker          __first_constructed(false),
623*58b9f456SAndroid Build Coastguard Worker          __second_constructed(false)
624*58b9f456SAndroid Build Coastguard Worker        {}
625*58b9f456SAndroid Build Coastguard Worker
626*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
627*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
628*58b9f456SAndroid Build Coastguard Worker    __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT
629*58b9f456SAndroid Build Coastguard Worker        : __na_(__x.__na_),
630*58b9f456SAndroid Build Coastguard Worker          __first_constructed(__x.__value_constructed),
631*58b9f456SAndroid Build Coastguard Worker          __second_constructed(__x.__value_constructed)
632*58b9f456SAndroid Build Coastguard Worker        {
633*58b9f456SAndroid Build Coastguard Worker            __x.__value_constructed = false;
634*58b9f456SAndroid Build Coastguard Worker        }
635*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
636*58b9f456SAndroid Build Coastguard Worker
637*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
638*58b9f456SAndroid Build Coastguard Worker    void operator()(pointer __p) _NOEXCEPT
639*58b9f456SAndroid Build Coastguard Worker    {
640*58b9f456SAndroid Build Coastguard Worker        if (__second_constructed)
641*58b9f456SAndroid Build Coastguard Worker            __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__get_value().second));
642*58b9f456SAndroid Build Coastguard Worker        if (__first_constructed)
643*58b9f456SAndroid Build Coastguard Worker            __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__get_value().first));
644*58b9f456SAndroid Build Coastguard Worker        if (__p)
645*58b9f456SAndroid Build Coastguard Worker            __alloc_traits::deallocate(__na_, __p, 1);
646*58b9f456SAndroid Build Coastguard Worker    }
647*58b9f456SAndroid Build Coastguard Worker};
648*58b9f456SAndroid Build Coastguard Worker
649*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
650*58b9f456SAndroid Build Coastguard Worker    class map;
651*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
652*58b9f456SAndroid Build Coastguard Worker    class multimap;
653*58b9f456SAndroid Build Coastguard Workertemplate <class _TreeIterator> class __map_const_iterator;
654*58b9f456SAndroid Build Coastguard Worker
655*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
656*58b9f456SAndroid Build Coastguard Worker
657*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp>
658*58b9f456SAndroid Build Coastguard Workerstruct __value_type
659*58b9f456SAndroid Build Coastguard Worker{
660*58b9f456SAndroid Build Coastguard Worker    typedef _Key                                     key_type;
661*58b9f456SAndroid Build Coastguard Worker    typedef _Tp                                      mapped_type;
662*58b9f456SAndroid Build Coastguard Worker    typedef pair<const key_type, mapped_type>        value_type;
663*58b9f456SAndroid Build Coastguard Worker    typedef pair<key_type&, mapped_type&>            __nc_ref_pair_type;
664*58b9f456SAndroid Build Coastguard Worker    typedef pair<key_type&&, mapped_type&&>          __nc_rref_pair_type;
665*58b9f456SAndroid Build Coastguard Worker
666*58b9f456SAndroid Build Coastguard Workerprivate:
667*58b9f456SAndroid Build Coastguard Worker    value_type __cc;
668*58b9f456SAndroid Build Coastguard Worker
669*58b9f456SAndroid Build Coastguard Workerpublic:
670*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
671*58b9f456SAndroid Build Coastguard Worker    value_type& __get_value()
672*58b9f456SAndroid Build Coastguard Worker    {
673*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
674*58b9f456SAndroid Build Coastguard Worker        return *_VSTD::launder(_VSTD::addressof(__cc));
675*58b9f456SAndroid Build Coastguard Worker#else
676*58b9f456SAndroid Build Coastguard Worker        return __cc;
677*58b9f456SAndroid Build Coastguard Worker#endif
678*58b9f456SAndroid Build Coastguard Worker    }
679*58b9f456SAndroid Build Coastguard Worker
680*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
681*58b9f456SAndroid Build Coastguard Worker    const value_type& __get_value() const
682*58b9f456SAndroid Build Coastguard Worker    {
683*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
684*58b9f456SAndroid Build Coastguard Worker        return *_VSTD::launder(_VSTD::addressof(__cc));
685*58b9f456SAndroid Build Coastguard Worker#else
686*58b9f456SAndroid Build Coastguard Worker        return __cc;
687*58b9f456SAndroid Build Coastguard Worker#endif
688*58b9f456SAndroid Build Coastguard Worker    }
689*58b9f456SAndroid Build Coastguard Worker
690*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
691*58b9f456SAndroid Build Coastguard Worker    __nc_ref_pair_type __ref()
692*58b9f456SAndroid Build Coastguard Worker    {
693*58b9f456SAndroid Build Coastguard Worker        value_type& __v = __get_value();
694*58b9f456SAndroid Build Coastguard Worker        return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
695*58b9f456SAndroid Build Coastguard Worker    }
696*58b9f456SAndroid Build Coastguard Worker
697*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
698*58b9f456SAndroid Build Coastguard Worker    __nc_rref_pair_type __move()
699*58b9f456SAndroid Build Coastguard Worker    {
700*58b9f456SAndroid Build Coastguard Worker        value_type& __v = __get_value();
701*58b9f456SAndroid Build Coastguard Worker        return __nc_rref_pair_type(
702*58b9f456SAndroid Build Coastguard Worker            _VSTD::move(const_cast<key_type&>(__v.first)),
703*58b9f456SAndroid Build Coastguard Worker            _VSTD::move(__v.second));
704*58b9f456SAndroid Build Coastguard Worker    }
705*58b9f456SAndroid Build Coastguard Worker
706*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
707*58b9f456SAndroid Build Coastguard Worker    __value_type& operator=(const __value_type& __v)
708*58b9f456SAndroid Build Coastguard Worker    {
709*58b9f456SAndroid Build Coastguard Worker        __ref() = __v.__get_value();
710*58b9f456SAndroid Build Coastguard Worker        return *this;
711*58b9f456SAndroid Build Coastguard Worker    }
712*58b9f456SAndroid Build Coastguard Worker
713*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
714*58b9f456SAndroid Build Coastguard Worker    __value_type& operator=(__value_type&& __v)
715*58b9f456SAndroid Build Coastguard Worker    {
716*58b9f456SAndroid Build Coastguard Worker        __ref() = __v.__move();
717*58b9f456SAndroid Build Coastguard Worker        return *this;
718*58b9f456SAndroid Build Coastguard Worker    }
719*58b9f456SAndroid Build Coastguard Worker
720*58b9f456SAndroid Build Coastguard Worker    template <class _ValueTp,
721*58b9f456SAndroid Build Coastguard Worker              class = typename enable_if<
722*58b9f456SAndroid Build Coastguard Worker                    __is_same_uncvref<_ValueTp, value_type>::value
723*58b9f456SAndroid Build Coastguard Worker                 >::type
724*58b9f456SAndroid Build Coastguard Worker             >
725*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
726*58b9f456SAndroid Build Coastguard Worker    __value_type& operator=(_ValueTp&& __v)
727*58b9f456SAndroid Build Coastguard Worker    {
728*58b9f456SAndroid Build Coastguard Worker        __ref() = _VSTD::forward<_ValueTp>(__v);
729*58b9f456SAndroid Build Coastguard Worker        return *this;
730*58b9f456SAndroid Build Coastguard Worker    }
731*58b9f456SAndroid Build Coastguard Worker
732*58b9f456SAndroid Build Coastguard Workerprivate:
733*58b9f456SAndroid Build Coastguard Worker    __value_type() _LIBCPP_EQUAL_DELETE;
734*58b9f456SAndroid Build Coastguard Worker    ~__value_type() _LIBCPP_EQUAL_DELETE;
735*58b9f456SAndroid Build Coastguard Worker    __value_type(const __value_type& __v) _LIBCPP_EQUAL_DELETE;
736*58b9f456SAndroid Build Coastguard Worker    __value_type(__value_type&& __v) _LIBCPP_EQUAL_DELETE;
737*58b9f456SAndroid Build Coastguard Worker};
738*58b9f456SAndroid Build Coastguard Worker
739*58b9f456SAndroid Build Coastguard Worker#else
740*58b9f456SAndroid Build Coastguard Worker
741*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp>
742*58b9f456SAndroid Build Coastguard Workerstruct __value_type
743*58b9f456SAndroid Build Coastguard Worker{
744*58b9f456SAndroid Build Coastguard Worker    typedef _Key                                     key_type;
745*58b9f456SAndroid Build Coastguard Worker    typedef _Tp                                      mapped_type;
746*58b9f456SAndroid Build Coastguard Worker    typedef pair<const key_type, mapped_type>        value_type;
747*58b9f456SAndroid Build Coastguard Worker
748*58b9f456SAndroid Build Coastguard Workerprivate:
749*58b9f456SAndroid Build Coastguard Worker    value_type __cc;
750*58b9f456SAndroid Build Coastguard Worker
751*58b9f456SAndroid Build Coastguard Workerpublic:
752*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
753*58b9f456SAndroid Build Coastguard Worker    value_type& __get_value() { return __cc; }
754*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
755*58b9f456SAndroid Build Coastguard Worker    const value_type& __get_value() const { return __cc; }
756*58b9f456SAndroid Build Coastguard Worker
757*58b9f456SAndroid Build Coastguard Workerprivate:
758*58b9f456SAndroid Build Coastguard Worker   __value_type();
759*58b9f456SAndroid Build Coastguard Worker   __value_type(__value_type const&);
760*58b9f456SAndroid Build Coastguard Worker   __value_type& operator=(__value_type const&);
761*58b9f456SAndroid Build Coastguard Worker   ~__value_type();
762*58b9f456SAndroid Build Coastguard Worker};
763*58b9f456SAndroid Build Coastguard Worker
764*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CXX03_LANG
765*58b9f456SAndroid Build Coastguard Worker
766*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp>
767*58b9f456SAndroid Build Coastguard Workerstruct __extract_key_value_types;
768*58b9f456SAndroid Build Coastguard Worker
769*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp>
770*58b9f456SAndroid Build Coastguard Workerstruct __extract_key_value_types<__value_type<_Key, _Tp> >
771*58b9f456SAndroid Build Coastguard Worker{
772*58b9f456SAndroid Build Coastguard Worker  typedef _Key const __key_type;
773*58b9f456SAndroid Build Coastguard Worker  typedef _Tp        __mapped_type;
774*58b9f456SAndroid Build Coastguard Worker};
775*58b9f456SAndroid Build Coastguard Worker
776*58b9f456SAndroid Build Coastguard Workertemplate <class _TreeIterator>
777*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS __map_iterator
778*58b9f456SAndroid Build Coastguard Worker{
779*58b9f456SAndroid Build Coastguard Worker    typedef typename _TreeIterator::_NodeTypes                   _NodeTypes;
780*58b9f456SAndroid Build Coastguard Worker    typedef typename _TreeIterator::__pointer_traits             __pointer_traits;
781*58b9f456SAndroid Build Coastguard Worker
782*58b9f456SAndroid Build Coastguard Worker    _TreeIterator __i_;
783*58b9f456SAndroid Build Coastguard Worker
784*58b9f456SAndroid Build Coastguard Workerpublic:
785*58b9f456SAndroid Build Coastguard Worker    typedef bidirectional_iterator_tag                           iterator_category;
786*58b9f456SAndroid Build Coastguard Worker    typedef typename _NodeTypes::__map_value_type                value_type;
787*58b9f456SAndroid Build Coastguard Worker    typedef typename _TreeIterator::difference_type              difference_type;
788*58b9f456SAndroid Build Coastguard Worker    typedef value_type&                                          reference;
789*58b9f456SAndroid Build Coastguard Worker    typedef typename _NodeTypes::__map_value_type_pointer        pointer;
790*58b9f456SAndroid Build Coastguard Worker
791*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
792*58b9f456SAndroid Build Coastguard Worker    __map_iterator() _NOEXCEPT {}
793*58b9f456SAndroid Build Coastguard Worker
794*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
795*58b9f456SAndroid Build Coastguard Worker    __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
796*58b9f456SAndroid Build Coastguard Worker
797*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
798*58b9f456SAndroid Build Coastguard Worker    reference operator*() const {return __i_->__get_value();}
799*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
800*58b9f456SAndroid Build Coastguard Worker    pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
801*58b9f456SAndroid Build Coastguard Worker
802*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
803*58b9f456SAndroid Build Coastguard Worker    __map_iterator& operator++() {++__i_; return *this;}
804*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
805*58b9f456SAndroid Build Coastguard Worker    __map_iterator operator++(int)
806*58b9f456SAndroid Build Coastguard Worker    {
807*58b9f456SAndroid Build Coastguard Worker        __map_iterator __t(*this);
808*58b9f456SAndroid Build Coastguard Worker        ++(*this);
809*58b9f456SAndroid Build Coastguard Worker        return __t;
810*58b9f456SAndroid Build Coastguard Worker    }
811*58b9f456SAndroid Build Coastguard Worker
812*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
813*58b9f456SAndroid Build Coastguard Worker    __map_iterator& operator--() {--__i_; return *this;}
814*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
815*58b9f456SAndroid Build Coastguard Worker    __map_iterator operator--(int)
816*58b9f456SAndroid Build Coastguard Worker    {
817*58b9f456SAndroid Build Coastguard Worker        __map_iterator __t(*this);
818*58b9f456SAndroid Build Coastguard Worker        --(*this);
819*58b9f456SAndroid Build Coastguard Worker        return __t;
820*58b9f456SAndroid Build Coastguard Worker    }
821*58b9f456SAndroid Build Coastguard Worker
822*58b9f456SAndroid Build Coastguard Worker    friend _LIBCPP_INLINE_VISIBILITY
823*58b9f456SAndroid Build Coastguard Worker    bool operator==(const __map_iterator& __x, const __map_iterator& __y)
824*58b9f456SAndroid Build Coastguard Worker        {return __x.__i_ == __y.__i_;}
825*58b9f456SAndroid Build Coastguard Worker    friend
826*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
827*58b9f456SAndroid Build Coastguard Worker    bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
828*58b9f456SAndroid Build Coastguard Worker        {return __x.__i_ != __y.__i_;}
829*58b9f456SAndroid Build Coastguard Worker
830*58b9f456SAndroid Build Coastguard Worker    template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
831*58b9f456SAndroid Build Coastguard Worker    template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
832*58b9f456SAndroid Build Coastguard Worker    template <class> friend class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
833*58b9f456SAndroid Build Coastguard Worker};
834*58b9f456SAndroid Build Coastguard Worker
835*58b9f456SAndroid Build Coastguard Workertemplate <class _TreeIterator>
836*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS __map_const_iterator
837*58b9f456SAndroid Build Coastguard Worker{
838*58b9f456SAndroid Build Coastguard Worker    typedef typename _TreeIterator::_NodeTypes                   _NodeTypes;
839*58b9f456SAndroid Build Coastguard Worker    typedef typename _TreeIterator::__pointer_traits             __pointer_traits;
840*58b9f456SAndroid Build Coastguard Worker
841*58b9f456SAndroid Build Coastguard Worker    _TreeIterator __i_;
842*58b9f456SAndroid Build Coastguard Worker
843*58b9f456SAndroid Build Coastguard Workerpublic:
844*58b9f456SAndroid Build Coastguard Worker    typedef bidirectional_iterator_tag                           iterator_category;
845*58b9f456SAndroid Build Coastguard Worker    typedef typename _NodeTypes::__map_value_type                value_type;
846*58b9f456SAndroid Build Coastguard Worker    typedef typename _TreeIterator::difference_type              difference_type;
847*58b9f456SAndroid Build Coastguard Worker    typedef const value_type&                                    reference;
848*58b9f456SAndroid Build Coastguard Worker    typedef typename _NodeTypes::__const_map_value_type_pointer  pointer;
849*58b9f456SAndroid Build Coastguard Worker
850*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
851*58b9f456SAndroid Build Coastguard Worker    __map_const_iterator() _NOEXCEPT {}
852*58b9f456SAndroid Build Coastguard Worker
853*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
854*58b9f456SAndroid Build Coastguard Worker    __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
855*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
856*58b9f456SAndroid Build Coastguard Worker    __map_const_iterator(__map_iterator<
857*58b9f456SAndroid Build Coastguard Worker        typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT
858*58b9f456SAndroid Build Coastguard Worker        : __i_(__i.__i_) {}
859*58b9f456SAndroid Build Coastguard Worker
860*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
861*58b9f456SAndroid Build Coastguard Worker    reference operator*() const {return __i_->__get_value();}
862*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
863*58b9f456SAndroid Build Coastguard Worker    pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
864*58b9f456SAndroid Build Coastguard Worker
865*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
866*58b9f456SAndroid Build Coastguard Worker    __map_const_iterator& operator++() {++__i_; return *this;}
867*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
868*58b9f456SAndroid Build Coastguard Worker    __map_const_iterator operator++(int)
869*58b9f456SAndroid Build Coastguard Worker    {
870*58b9f456SAndroid Build Coastguard Worker        __map_const_iterator __t(*this);
871*58b9f456SAndroid Build Coastguard Worker        ++(*this);
872*58b9f456SAndroid Build Coastguard Worker        return __t;
873*58b9f456SAndroid Build Coastguard Worker    }
874*58b9f456SAndroid Build Coastguard Worker
875*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
876*58b9f456SAndroid Build Coastguard Worker    __map_const_iterator& operator--() {--__i_; return *this;}
877*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
878*58b9f456SAndroid Build Coastguard Worker    __map_const_iterator operator--(int)
879*58b9f456SAndroid Build Coastguard Worker    {
880*58b9f456SAndroid Build Coastguard Worker        __map_const_iterator __t(*this);
881*58b9f456SAndroid Build Coastguard Worker        --(*this);
882*58b9f456SAndroid Build Coastguard Worker        return __t;
883*58b9f456SAndroid Build Coastguard Worker    }
884*58b9f456SAndroid Build Coastguard Worker
885*58b9f456SAndroid Build Coastguard Worker    friend _LIBCPP_INLINE_VISIBILITY
886*58b9f456SAndroid Build Coastguard Worker    bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y)
887*58b9f456SAndroid Build Coastguard Worker        {return __x.__i_ == __y.__i_;}
888*58b9f456SAndroid Build Coastguard Worker    friend _LIBCPP_INLINE_VISIBILITY
889*58b9f456SAndroid Build Coastguard Worker    bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
890*58b9f456SAndroid Build Coastguard Worker        {return __x.__i_ != __y.__i_;}
891*58b9f456SAndroid Build Coastguard Worker
892*58b9f456SAndroid Build Coastguard Worker    template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS map;
893*58b9f456SAndroid Build Coastguard Worker    template <class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS multimap;
894*58b9f456SAndroid Build Coastguard Worker    template <class, class, class> friend class _LIBCPP_TEMPLATE_VIS __tree_const_iterator;
895*58b9f456SAndroid Build Coastguard Worker};
896*58b9f456SAndroid Build Coastguard Worker
897*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare = less<_Key>,
898*58b9f456SAndroid Build Coastguard Worker          class _Allocator = allocator<pair<const _Key, _Tp> > >
899*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS map
900*58b9f456SAndroid Build Coastguard Worker{
901*58b9f456SAndroid Build Coastguard Workerpublic:
902*58b9f456SAndroid Build Coastguard Worker    // types:
903*58b9f456SAndroid Build Coastguard Worker    typedef _Key                                     key_type;
904*58b9f456SAndroid Build Coastguard Worker    typedef _Tp                                      mapped_type;
905*58b9f456SAndroid Build Coastguard Worker    typedef pair<const key_type, mapped_type>        value_type;
906*58b9f456SAndroid Build Coastguard Worker    typedef _Compare                                 key_compare;
907*58b9f456SAndroid Build Coastguard Worker    typedef _Allocator                               allocator_type;
908*58b9f456SAndroid Build Coastguard Worker    typedef value_type&                              reference;
909*58b9f456SAndroid Build Coastguard Worker    typedef const value_type&                        const_reference;
910*58b9f456SAndroid Build Coastguard Worker
911*58b9f456SAndroid Build Coastguard Worker    static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
912*58b9f456SAndroid Build Coastguard Worker    static_assert((is_same<typename allocator_type::value_type, value_type>::value),
913*58b9f456SAndroid Build Coastguard Worker                  "Allocator::value_type must be same type as value_type");
914*58b9f456SAndroid Build Coastguard Worker
915*58b9f456SAndroid Build Coastguard Worker    class _LIBCPP_TEMPLATE_VIS value_compare
916*58b9f456SAndroid Build Coastguard Worker        : public binary_function<value_type, value_type, bool>
917*58b9f456SAndroid Build Coastguard Worker    {
918*58b9f456SAndroid Build Coastguard Worker        friend class map;
919*58b9f456SAndroid Build Coastguard Worker    protected:
920*58b9f456SAndroid Build Coastguard Worker        key_compare comp;
921*58b9f456SAndroid Build Coastguard Worker
922*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY value_compare(key_compare c) : comp(c) {}
923*58b9f456SAndroid Build Coastguard Worker    public:
924*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
925*58b9f456SAndroid Build Coastguard Worker        bool operator()(const value_type& __x, const value_type& __y) const
926*58b9f456SAndroid Build Coastguard Worker            {return comp(__x.first, __y.first);}
927*58b9f456SAndroid Build Coastguard Worker    };
928*58b9f456SAndroid Build Coastguard Worker
929*58b9f456SAndroid Build Coastguard Workerprivate:
930*58b9f456SAndroid Build Coastguard Worker
931*58b9f456SAndroid Build Coastguard Worker    typedef _VSTD::__value_type<key_type, mapped_type>             __value_type;
932*58b9f456SAndroid Build Coastguard Worker    typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
933*58b9f456SAndroid Build Coastguard Worker    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
934*58b9f456SAndroid Build Coastguard Worker                                                 __value_type>::type __allocator_type;
935*58b9f456SAndroid Build Coastguard Worker    typedef __tree<__value_type, __vc, __allocator_type>   __base;
936*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node_traits                 __node_traits;
937*58b9f456SAndroid Build Coastguard Worker    typedef allocator_traits<allocator_type>               __alloc_traits;
938*58b9f456SAndroid Build Coastguard Worker
939*58b9f456SAndroid Build Coastguard Worker    __base __tree_;
940*58b9f456SAndroid Build Coastguard Worker
941*58b9f456SAndroid Build Coastguard Workerpublic:
942*58b9f456SAndroid Build Coastguard Worker    typedef typename __alloc_traits::pointer               pointer;
943*58b9f456SAndroid Build Coastguard Worker    typedef typename __alloc_traits::const_pointer         const_pointer;
944*58b9f456SAndroid Build Coastguard Worker    typedef typename __alloc_traits::size_type             size_type;
945*58b9f456SAndroid Build Coastguard Worker    typedef typename __alloc_traits::difference_type       difference_type;
946*58b9f456SAndroid Build Coastguard Worker    typedef __map_iterator<typename __base::iterator>             iterator;
947*58b9f456SAndroid Build Coastguard Worker    typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
948*58b9f456SAndroid Build Coastguard Worker    typedef _VSTD::reverse_iterator<iterator>               reverse_iterator;
949*58b9f456SAndroid Build Coastguard Worker    typedef _VSTD::reverse_iterator<const_iterator>         const_reverse_iterator;
950*58b9f456SAndroid Build Coastguard Worker
951*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
952*58b9f456SAndroid Build Coastguard Worker    typedef __map_node_handle<typename __base::__node, allocator_type> node_type;
953*58b9f456SAndroid Build Coastguard Worker    typedef __insert_return_type<iterator, node_type> insert_return_type;
954*58b9f456SAndroid Build Coastguard Worker#endif
955*58b9f456SAndroid Build Coastguard Worker
956*58b9f456SAndroid Build Coastguard Worker    template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
957*58b9f456SAndroid Build Coastguard Worker        friend class _LIBCPP_TEMPLATE_VIS map;
958*58b9f456SAndroid Build Coastguard Worker    template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
959*58b9f456SAndroid Build Coastguard Worker        friend class _LIBCPP_TEMPLATE_VIS multimap;
960*58b9f456SAndroid Build Coastguard Worker
961*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
962*58b9f456SAndroid Build Coastguard Worker    map()
963*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(
964*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
965*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<key_compare>::value &&
966*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value)
967*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(key_compare())) {}
968*58b9f456SAndroid Build Coastguard Worker
969*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
970*58b9f456SAndroid Build Coastguard Worker    explicit map(const key_compare& __comp)
971*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(
972*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
973*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value)
974*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp)) {}
975*58b9f456SAndroid Build Coastguard Worker
976*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
977*58b9f456SAndroid Build Coastguard Worker    explicit map(const key_compare& __comp, const allocator_type& __a)
978*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
979*58b9f456SAndroid Build Coastguard Worker
980*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
981*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
982*58b9f456SAndroid Build Coastguard Worker        map(_InputIterator __f, _InputIterator __l,
983*58b9f456SAndroid Build Coastguard Worker            const key_compare& __comp = key_compare())
984*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp))
985*58b9f456SAndroid Build Coastguard Worker        {
986*58b9f456SAndroid Build Coastguard Worker            insert(__f, __l);
987*58b9f456SAndroid Build Coastguard Worker        }
988*58b9f456SAndroid Build Coastguard Worker
989*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
990*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
991*58b9f456SAndroid Build Coastguard Worker        map(_InputIterator __f, _InputIterator __l,
992*58b9f456SAndroid Build Coastguard Worker            const key_compare& __comp, const allocator_type& __a)
993*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp), typename __base::allocator_type(__a))
994*58b9f456SAndroid Build Coastguard Worker        {
995*58b9f456SAndroid Build Coastguard Worker            insert(__f, __l);
996*58b9f456SAndroid Build Coastguard Worker        }
997*58b9f456SAndroid Build Coastguard Worker
998*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
999*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
1000*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1001*58b9f456SAndroid Build Coastguard Worker    map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
1002*58b9f456SAndroid Build Coastguard Worker        : map(__f, __l, key_compare(), __a) {}
1003*58b9f456SAndroid Build Coastguard Worker#endif
1004*58b9f456SAndroid Build Coastguard Worker
1005*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1006*58b9f456SAndroid Build Coastguard Worker    map(const map& __m)
1007*58b9f456SAndroid Build Coastguard Worker        : __tree_(__m.__tree_)
1008*58b9f456SAndroid Build Coastguard Worker        {
1009*58b9f456SAndroid Build Coastguard Worker            insert(__m.begin(), __m.end());
1010*58b9f456SAndroid Build Coastguard Worker        }
1011*58b9f456SAndroid Build Coastguard Worker
1012*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1013*58b9f456SAndroid Build Coastguard Worker    map& operator=(const map& __m)
1014*58b9f456SAndroid Build Coastguard Worker        {
1015*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1016*58b9f456SAndroid Build Coastguard Worker            __tree_ = __m.__tree_;
1017*58b9f456SAndroid Build Coastguard Worker#else
1018*58b9f456SAndroid Build Coastguard Worker            if (this != &__m) {
1019*58b9f456SAndroid Build Coastguard Worker                __tree_.clear();
1020*58b9f456SAndroid Build Coastguard Worker                __tree_.value_comp() = __m.__tree_.value_comp();
1021*58b9f456SAndroid Build Coastguard Worker                __tree_.__copy_assign_alloc(__m.__tree_);
1022*58b9f456SAndroid Build Coastguard Worker                insert(__m.begin(), __m.end());
1023*58b9f456SAndroid Build Coastguard Worker            }
1024*58b9f456SAndroid Build Coastguard Worker#endif
1025*58b9f456SAndroid Build Coastguard Worker            return *this;
1026*58b9f456SAndroid Build Coastguard Worker        }
1027*58b9f456SAndroid Build Coastguard Worker
1028*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1029*58b9f456SAndroid Build Coastguard Worker
1030*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1031*58b9f456SAndroid Build Coastguard Worker    map(map&& __m)
1032*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
1033*58b9f456SAndroid Build Coastguard Worker        : __tree_(_VSTD::move(__m.__tree_))
1034*58b9f456SAndroid Build Coastguard Worker        {
1035*58b9f456SAndroid Build Coastguard Worker        }
1036*58b9f456SAndroid Build Coastguard Worker
1037*58b9f456SAndroid Build Coastguard Worker    map(map&& __m, const allocator_type& __a);
1038*58b9f456SAndroid Build Coastguard Worker
1039*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1040*58b9f456SAndroid Build Coastguard Worker    map& operator=(map&& __m)
1041*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
1042*58b9f456SAndroid Build Coastguard Worker        {
1043*58b9f456SAndroid Build Coastguard Worker            __tree_ = _VSTD::move(__m.__tree_);
1044*58b9f456SAndroid Build Coastguard Worker            return *this;
1045*58b9f456SAndroid Build Coastguard Worker        }
1046*58b9f456SAndroid Build Coastguard Worker
1047*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1048*58b9f456SAndroid Build Coastguard Worker    map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
1049*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp))
1050*58b9f456SAndroid Build Coastguard Worker        {
1051*58b9f456SAndroid Build Coastguard Worker            insert(__il.begin(), __il.end());
1052*58b9f456SAndroid Build Coastguard Worker        }
1053*58b9f456SAndroid Build Coastguard Worker
1054*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1055*58b9f456SAndroid Build Coastguard Worker    map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
1056*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp), typename __base::allocator_type(__a))
1057*58b9f456SAndroid Build Coastguard Worker        {
1058*58b9f456SAndroid Build Coastguard Worker            insert(__il.begin(), __il.end());
1059*58b9f456SAndroid Build Coastguard Worker        }
1060*58b9f456SAndroid Build Coastguard Worker
1061*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1062*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1063*58b9f456SAndroid Build Coastguard Worker    map(initializer_list<value_type> __il, const allocator_type& __a)
1064*58b9f456SAndroid Build Coastguard Worker        : map(__il, key_compare(), __a) {}
1065*58b9f456SAndroid Build Coastguard Worker#endif
1066*58b9f456SAndroid Build Coastguard Worker
1067*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1068*58b9f456SAndroid Build Coastguard Worker    map& operator=(initializer_list<value_type> __il)
1069*58b9f456SAndroid Build Coastguard Worker        {
1070*58b9f456SAndroid Build Coastguard Worker            __tree_.__assign_unique(__il.begin(), __il.end());
1071*58b9f456SAndroid Build Coastguard Worker            return *this;
1072*58b9f456SAndroid Build Coastguard Worker        }
1073*58b9f456SAndroid Build Coastguard Worker
1074*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
1075*58b9f456SAndroid Build Coastguard Worker
1076*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1077*58b9f456SAndroid Build Coastguard Worker    explicit map(const allocator_type& __a)
1078*58b9f456SAndroid Build Coastguard Worker        : __tree_(typename __base::allocator_type(__a))
1079*58b9f456SAndroid Build Coastguard Worker        {
1080*58b9f456SAndroid Build Coastguard Worker        }
1081*58b9f456SAndroid Build Coastguard Worker
1082*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1083*58b9f456SAndroid Build Coastguard Worker    map(const map& __m, const allocator_type& __a)
1084*58b9f456SAndroid Build Coastguard Worker        : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a))
1085*58b9f456SAndroid Build Coastguard Worker        {
1086*58b9f456SAndroid Build Coastguard Worker            insert(__m.begin(), __m.end());
1087*58b9f456SAndroid Build Coastguard Worker        }
1088*58b9f456SAndroid Build Coastguard Worker
1089*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1090*58b9f456SAndroid Build Coastguard Worker          iterator begin() _NOEXCEPT {return __tree_.begin();}
1091*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1092*58b9f456SAndroid Build Coastguard Worker    const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
1093*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1094*58b9f456SAndroid Build Coastguard Worker          iterator end() _NOEXCEPT {return __tree_.end();}
1095*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1096*58b9f456SAndroid Build Coastguard Worker    const_iterator end() const _NOEXCEPT {return __tree_.end();}
1097*58b9f456SAndroid Build Coastguard Worker
1098*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1099*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
1100*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1101*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rbegin() const _NOEXCEPT
1102*58b9f456SAndroid Build Coastguard Worker        {return const_reverse_iterator(end());}
1103*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1104*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rend() _NOEXCEPT
1105*58b9f456SAndroid Build Coastguard Worker            {return       reverse_iterator(begin());}
1106*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1107*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rend() const _NOEXCEPT
1108*58b9f456SAndroid Build Coastguard Worker        {return const_reverse_iterator(begin());}
1109*58b9f456SAndroid Build Coastguard Worker
1110*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1111*58b9f456SAndroid Build Coastguard Worker    const_iterator cbegin() const _NOEXCEPT {return begin();}
1112*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1113*58b9f456SAndroid Build Coastguard Worker    const_iterator cend() const _NOEXCEPT {return end();}
1114*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1115*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
1116*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1117*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crend() const _NOEXCEPT {return rend();}
1118*58b9f456SAndroid Build Coastguard Worker
1119*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
1120*58b9f456SAndroid Build Coastguard Worker    bool      empty() const _NOEXCEPT {return __tree_.size() == 0;}
1121*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1122*58b9f456SAndroid Build Coastguard Worker    size_type size() const _NOEXCEPT {return __tree_.size();}
1123*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1124*58b9f456SAndroid Build Coastguard Worker    size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
1125*58b9f456SAndroid Build Coastguard Worker
1126*58b9f456SAndroid Build Coastguard Worker    mapped_type& operator[](const key_type& __k);
1127*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1128*58b9f456SAndroid Build Coastguard Worker    mapped_type& operator[](key_type&& __k);
1129*58b9f456SAndroid Build Coastguard Worker#endif
1130*58b9f456SAndroid Build Coastguard Worker
1131*58b9f456SAndroid Build Coastguard Worker          mapped_type& at(const key_type& __k);
1132*58b9f456SAndroid Build Coastguard Worker    const mapped_type& at(const key_type& __k) const;
1133*58b9f456SAndroid Build Coastguard Worker
1134*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1135*58b9f456SAndroid Build Coastguard Worker    allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__tree_.__alloc());}
1136*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1137*58b9f456SAndroid Build Coastguard Worker    key_compare    key_comp()      const {return __tree_.value_comp().key_comp();}
1138*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1139*58b9f456SAndroid Build Coastguard Worker    value_compare  value_comp()    const {return value_compare(__tree_.value_comp().key_comp());}
1140*58b9f456SAndroid Build Coastguard Worker
1141*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1142*58b9f456SAndroid Build Coastguard Worker    template <class ..._Args>
1143*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1144*58b9f456SAndroid Build Coastguard Worker    pair<iterator, bool> emplace(_Args&& ...__args) {
1145*58b9f456SAndroid Build Coastguard Worker        return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);
1146*58b9f456SAndroid Build Coastguard Worker    }
1147*58b9f456SAndroid Build Coastguard Worker
1148*58b9f456SAndroid Build Coastguard Worker    template <class ..._Args>
1149*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1150*58b9f456SAndroid Build Coastguard Worker    iterator emplace_hint(const_iterator __p, _Args&& ...__args) {
1151*58b9f456SAndroid Build Coastguard Worker        return __tree_.__emplace_hint_unique(__p.__i_, _VSTD::forward<_Args>(__args)...);
1152*58b9f456SAndroid Build Coastguard Worker    }
1153*58b9f456SAndroid Build Coastguard Worker
1154*58b9f456SAndroid Build Coastguard Worker    template <class _Pp,
1155*58b9f456SAndroid Build Coastguard Worker              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
1156*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1157*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> insert(_Pp&& __p)
1158*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__insert_unique(_VSTD::forward<_Pp>(__p));}
1159*58b9f456SAndroid Build Coastguard Worker
1160*58b9f456SAndroid Build Coastguard Worker    template <class _Pp,
1161*58b9f456SAndroid Build Coastguard Worker              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
1162*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1163*58b9f456SAndroid Build Coastguard Worker        iterator insert(const_iterator __pos, _Pp&& __p)
1164*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_Pp>(__p));}
1165*58b9f456SAndroid Build Coastguard Worker
1166*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
1167*58b9f456SAndroid Build Coastguard Worker
1168*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1169*58b9f456SAndroid Build Coastguard Worker    pair<iterator, bool>
1170*58b9f456SAndroid Build Coastguard Worker        insert(const value_type& __v) {return __tree_.__insert_unique(__v);}
1171*58b9f456SAndroid Build Coastguard Worker
1172*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1173*58b9f456SAndroid Build Coastguard Worker    iterator
1174*58b9f456SAndroid Build Coastguard Worker        insert(const_iterator __p, const value_type& __v)
1175*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__insert_unique(__p.__i_, __v);}
1176*58b9f456SAndroid Build Coastguard Worker
1177*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1178*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1179*58b9f456SAndroid Build Coastguard Worker    pair<iterator, bool>
1180*58b9f456SAndroid Build Coastguard Worker    insert(value_type&& __v) {return __tree_.__insert_unique(_VSTD::move(__v));}
1181*58b9f456SAndroid Build Coastguard Worker
1182*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1183*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __p,  value_type&& __v)
1184*58b9f456SAndroid Build Coastguard Worker    {return __tree_.__insert_unique(__p.__i_, _VSTD::move(__v));}
1185*58b9f456SAndroid Build Coastguard Worker
1186*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1187*58b9f456SAndroid Build Coastguard Worker    void insert(initializer_list<value_type> __il)
1188*58b9f456SAndroid Build Coastguard Worker        {insert(__il.begin(), __il.end());}
1189*58b9f456SAndroid Build Coastguard Worker#endif
1190*58b9f456SAndroid Build Coastguard Worker
1191*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
1192*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1193*58b9f456SAndroid Build Coastguard Worker        void insert(_InputIterator __f, _InputIterator __l)
1194*58b9f456SAndroid Build Coastguard Worker        {
1195*58b9f456SAndroid Build Coastguard Worker            for (const_iterator __e = cend(); __f != __l; ++__f)
1196*58b9f456SAndroid Build Coastguard Worker                insert(__e.__i_, *__f);
1197*58b9f456SAndroid Build Coastguard Worker        }
1198*58b9f456SAndroid Build Coastguard Worker
1199*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
1200*58b9f456SAndroid Build Coastguard Worker
1201*58b9f456SAndroid Build Coastguard Worker    template <class... _Args>
1202*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1203*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
1204*58b9f456SAndroid Build Coastguard Worker    {
1205*58b9f456SAndroid Build Coastguard Worker        return __tree_.__emplace_unique_key_args(__k,
1206*58b9f456SAndroid Build Coastguard Worker            _VSTD::piecewise_construct,
1207*58b9f456SAndroid Build Coastguard Worker            _VSTD::forward_as_tuple(__k),
1208*58b9f456SAndroid Build Coastguard Worker            _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
1209*58b9f456SAndroid Build Coastguard Worker    }
1210*58b9f456SAndroid Build Coastguard Worker
1211*58b9f456SAndroid Build Coastguard Worker    template <class... _Args>
1212*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1213*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
1214*58b9f456SAndroid Build Coastguard Worker    {
1215*58b9f456SAndroid Build Coastguard Worker        return __tree_.__emplace_unique_key_args(__k,
1216*58b9f456SAndroid Build Coastguard Worker            _VSTD::piecewise_construct,
1217*58b9f456SAndroid Build Coastguard Worker            _VSTD::forward_as_tuple(_VSTD::move(__k)),
1218*58b9f456SAndroid Build Coastguard Worker            _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
1219*58b9f456SAndroid Build Coastguard Worker    }
1220*58b9f456SAndroid Build Coastguard Worker
1221*58b9f456SAndroid Build Coastguard Worker    template <class... _Args>
1222*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1223*58b9f456SAndroid Build Coastguard Worker        iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
1224*58b9f456SAndroid Build Coastguard Worker    {
1225*58b9f456SAndroid Build Coastguard Worker        return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k,
1226*58b9f456SAndroid Build Coastguard Worker            _VSTD::piecewise_construct,
1227*58b9f456SAndroid Build Coastguard Worker            _VSTD::forward_as_tuple(__k),
1228*58b9f456SAndroid Build Coastguard Worker            _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
1229*58b9f456SAndroid Build Coastguard Worker    }
1230*58b9f456SAndroid Build Coastguard Worker
1231*58b9f456SAndroid Build Coastguard Worker    template <class... _Args>
1232*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1233*58b9f456SAndroid Build Coastguard Worker        iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
1234*58b9f456SAndroid Build Coastguard Worker    {
1235*58b9f456SAndroid Build Coastguard Worker        return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k,
1236*58b9f456SAndroid Build Coastguard Worker            _VSTD::piecewise_construct,
1237*58b9f456SAndroid Build Coastguard Worker            _VSTD::forward_as_tuple(_VSTD::move(__k)),
1238*58b9f456SAndroid Build Coastguard Worker            _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
1239*58b9f456SAndroid Build Coastguard Worker    }
1240*58b9f456SAndroid Build Coastguard Worker
1241*58b9f456SAndroid Build Coastguard Worker    template <class _Vp>
1242*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1243*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v)
1244*58b9f456SAndroid Build Coastguard Worker    {
1245*58b9f456SAndroid Build Coastguard Worker        iterator __p = lower_bound(__k);
1246*58b9f456SAndroid Build Coastguard Worker        if ( __p != end() && !key_comp()(__k, __p->first))
1247*58b9f456SAndroid Build Coastguard Worker        {
1248*58b9f456SAndroid Build Coastguard Worker            __p->second = _VSTD::forward<_Vp>(__v);
1249*58b9f456SAndroid Build Coastguard Worker            return _VSTD::make_pair(__p, false);
1250*58b9f456SAndroid Build Coastguard Worker        }
1251*58b9f456SAndroid Build Coastguard Worker        return _VSTD::make_pair(emplace_hint(__p, __k, _VSTD::forward<_Vp>(__v)), true);
1252*58b9f456SAndroid Build Coastguard Worker    }
1253*58b9f456SAndroid Build Coastguard Worker
1254*58b9f456SAndroid Build Coastguard Worker    template <class _Vp>
1255*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1256*58b9f456SAndroid Build Coastguard Worker        pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v)
1257*58b9f456SAndroid Build Coastguard Worker    {
1258*58b9f456SAndroid Build Coastguard Worker        iterator __p = lower_bound(__k);
1259*58b9f456SAndroid Build Coastguard Worker        if ( __p != end() && !key_comp()(__k, __p->first))
1260*58b9f456SAndroid Build Coastguard Worker        {
1261*58b9f456SAndroid Build Coastguard Worker            __p->second = _VSTD::forward<_Vp>(__v);
1262*58b9f456SAndroid Build Coastguard Worker            return _VSTD::make_pair(__p, false);
1263*58b9f456SAndroid Build Coastguard Worker        }
1264*58b9f456SAndroid Build Coastguard Worker        return _VSTD::make_pair(emplace_hint(__p, _VSTD::move(__k), _VSTD::forward<_Vp>(__v)), true);
1265*58b9f456SAndroid Build Coastguard Worker    }
1266*58b9f456SAndroid Build Coastguard Worker
1267*58b9f456SAndroid Build Coastguard Worker    template <class _Vp>
1268*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1269*58b9f456SAndroid Build Coastguard Worker        iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v)
1270*58b9f456SAndroid Build Coastguard Worker     {
1271*58b9f456SAndroid Build Coastguard Worker        iterator __p = lower_bound(__k);
1272*58b9f456SAndroid Build Coastguard Worker        if ( __p != end() && !key_comp()(__k, __p->first))
1273*58b9f456SAndroid Build Coastguard Worker        {
1274*58b9f456SAndroid Build Coastguard Worker            __p->second = _VSTD::forward<_Vp>(__v);
1275*58b9f456SAndroid Build Coastguard Worker            return __p;
1276*58b9f456SAndroid Build Coastguard Worker        }
1277*58b9f456SAndroid Build Coastguard Worker        return emplace_hint(__h, __k, _VSTD::forward<_Vp>(__v));
1278*58b9f456SAndroid Build Coastguard Worker     }
1279*58b9f456SAndroid Build Coastguard Worker
1280*58b9f456SAndroid Build Coastguard Worker    template <class _Vp>
1281*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1282*58b9f456SAndroid Build Coastguard Worker        iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v)
1283*58b9f456SAndroid Build Coastguard Worker     {
1284*58b9f456SAndroid Build Coastguard Worker        iterator __p = lower_bound(__k);
1285*58b9f456SAndroid Build Coastguard Worker        if ( __p != end() && !key_comp()(__k, __p->first))
1286*58b9f456SAndroid Build Coastguard Worker        {
1287*58b9f456SAndroid Build Coastguard Worker            __p->second = _VSTD::forward<_Vp>(__v);
1288*58b9f456SAndroid Build Coastguard Worker            return __p;
1289*58b9f456SAndroid Build Coastguard Worker        }
1290*58b9f456SAndroid Build Coastguard Worker        return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v));
1291*58b9f456SAndroid Build Coastguard Worker     }
1292*58b9f456SAndroid Build Coastguard Worker
1293*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_STD_VER > 14
1294*58b9f456SAndroid Build Coastguard Worker
1295*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1296*58b9f456SAndroid Build Coastguard Worker    iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
1297*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1298*58b9f456SAndroid Build Coastguard Worker    iterator erase(iterator __p)       {return __tree_.erase(__p.__i_);}
1299*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1300*58b9f456SAndroid Build Coastguard Worker    size_type erase(const key_type& __k)
1301*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__erase_unique(__k);}
1302*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1303*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator __f, const_iterator __l)
1304*58b9f456SAndroid Build Coastguard Worker        {return __tree_.erase(__f.__i_, __l.__i_);}
1305*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1306*58b9f456SAndroid Build Coastguard Worker    void clear() _NOEXCEPT {__tree_.clear();}
1307*58b9f456SAndroid Build Coastguard Worker
1308*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
1309*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1310*58b9f456SAndroid Build Coastguard Worker    insert_return_type insert(node_type&& __nh)
1311*58b9f456SAndroid Build Coastguard Worker    {
1312*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
1313*58b9f456SAndroid Build Coastguard Worker            "node_type with incompatible allocator passed to map::insert()");
1314*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_insert_unique<
1315*58b9f456SAndroid Build Coastguard Worker            node_type, insert_return_type>(_VSTD::move(__nh));
1316*58b9f456SAndroid Build Coastguard Worker    }
1317*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1318*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __hint, node_type&& __nh)
1319*58b9f456SAndroid Build Coastguard Worker    {
1320*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
1321*58b9f456SAndroid Build Coastguard Worker            "node_type with incompatible allocator passed to map::insert()");
1322*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_insert_unique<node_type>(
1323*58b9f456SAndroid Build Coastguard Worker            __hint.__i_, _VSTD::move(__nh));
1324*58b9f456SAndroid Build Coastguard Worker    }
1325*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1326*58b9f456SAndroid Build Coastguard Worker    node_type extract(key_type const& __key)
1327*58b9f456SAndroid Build Coastguard Worker    {
1328*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_extract<node_type>(__key);
1329*58b9f456SAndroid Build Coastguard Worker    }
1330*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1331*58b9f456SAndroid Build Coastguard Worker    node_type extract(const_iterator __it)
1332*58b9f456SAndroid Build Coastguard Worker    {
1333*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_extract<node_type>(__it.__i_);
1334*58b9f456SAndroid Build Coastguard Worker    }
1335*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1336*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1337*58b9f456SAndroid Build Coastguard Worker    void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source)
1338*58b9f456SAndroid Build Coastguard Worker    {
1339*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1340*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1341*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_unique(__source.__tree_);
1342*58b9f456SAndroid Build Coastguard Worker    }
1343*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1344*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1345*58b9f456SAndroid Build Coastguard Worker    void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source)
1346*58b9f456SAndroid Build Coastguard Worker    {
1347*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1348*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1349*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_unique(__source.__tree_);
1350*58b9f456SAndroid Build Coastguard Worker    }
1351*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1352*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1353*58b9f456SAndroid Build Coastguard Worker    void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source)
1354*58b9f456SAndroid Build Coastguard Worker    {
1355*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1356*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1357*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_unique(__source.__tree_);
1358*58b9f456SAndroid Build Coastguard Worker    }
1359*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1360*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1361*58b9f456SAndroid Build Coastguard Worker    void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source)
1362*58b9f456SAndroid Build Coastguard Worker    {
1363*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1364*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1365*58b9f456SAndroid Build Coastguard Worker        __tree_.__node_handle_merge_unique(__source.__tree_);
1366*58b9f456SAndroid Build Coastguard Worker    }
1367*58b9f456SAndroid Build Coastguard Worker#endif
1368*58b9f456SAndroid Build Coastguard Worker
1369*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1370*58b9f456SAndroid Build Coastguard Worker    void swap(map& __m)
1371*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
1372*58b9f456SAndroid Build Coastguard Worker        {__tree_.swap(__m.__tree_);}
1373*58b9f456SAndroid Build Coastguard Worker
1374*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1375*58b9f456SAndroid Build Coastguard Worker    iterator find(const key_type& __k)             {return __tree_.find(__k);}
1376*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1377*58b9f456SAndroid Build Coastguard Worker    const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
1378*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1379*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1380*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1381*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
1382*58b9f456SAndroid Build Coastguard Worker    find(const _K2& __k)                           {return __tree_.find(__k);}
1383*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1384*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1385*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
1386*58b9f456SAndroid Build Coastguard Worker    find(const _K2& __k) const                     {return __tree_.find(__k);}
1387*58b9f456SAndroid Build Coastguard Worker#endif
1388*58b9f456SAndroid Build Coastguard Worker
1389*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1390*58b9f456SAndroid Build Coastguard Worker    size_type      count(const key_type& __k) const
1391*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__count_unique(__k);}
1392*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1393*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1394*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1395*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
1396*58b9f456SAndroid Build Coastguard Worker    count(const _K2& __k) const {return __tree_.__count_multi(__k);}
1397*58b9f456SAndroid Build Coastguard Worker#endif
1398*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1399*58b9f456SAndroid Build Coastguard Worker    iterator lower_bound(const key_type& __k)
1400*58b9f456SAndroid Build Coastguard Worker        {return __tree_.lower_bound(__k);}
1401*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1402*58b9f456SAndroid Build Coastguard Worker    const_iterator lower_bound(const key_type& __k) const
1403*58b9f456SAndroid Build Coastguard Worker        {return __tree_.lower_bound(__k);}
1404*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1405*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1406*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1407*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
1408*58b9f456SAndroid Build Coastguard Worker    lower_bound(const _K2& __k)       {return __tree_.lower_bound(__k);}
1409*58b9f456SAndroid Build Coastguard Worker
1410*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1411*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1412*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
1413*58b9f456SAndroid Build Coastguard Worker    lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
1414*58b9f456SAndroid Build Coastguard Worker#endif
1415*58b9f456SAndroid Build Coastguard Worker
1416*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1417*58b9f456SAndroid Build Coastguard Worker    iterator upper_bound(const key_type& __k)
1418*58b9f456SAndroid Build Coastguard Worker        {return __tree_.upper_bound(__k);}
1419*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1420*58b9f456SAndroid Build Coastguard Worker    const_iterator upper_bound(const key_type& __k) const
1421*58b9f456SAndroid Build Coastguard Worker        {return __tree_.upper_bound(__k);}
1422*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1423*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1424*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1425*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
1426*58b9f456SAndroid Build Coastguard Worker    upper_bound(const _K2& __k)       {return __tree_.upper_bound(__k);}
1427*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1428*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1429*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
1430*58b9f456SAndroid Build Coastguard Worker    upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
1431*58b9f456SAndroid Build Coastguard Worker#endif
1432*58b9f456SAndroid Build Coastguard Worker
1433*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1434*58b9f456SAndroid Build Coastguard Worker    pair<iterator,iterator> equal_range(const key_type& __k)
1435*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__equal_range_unique(__k);}
1436*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1437*58b9f456SAndroid Build Coastguard Worker    pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
1438*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__equal_range_unique(__k);}
1439*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1440*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1441*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1442*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
1443*58b9f456SAndroid Build Coastguard Worker    equal_range(const _K2& __k)       {return __tree_.__equal_range_multi(__k);}
1444*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
1445*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1446*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
1447*58b9f456SAndroid Build Coastguard Worker    equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
1448*58b9f456SAndroid Build Coastguard Worker#endif
1449*58b9f456SAndroid Build Coastguard Worker
1450*58b9f456SAndroid Build Coastguard Workerprivate:
1451*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node                    __node;
1452*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node_allocator          __node_allocator;
1453*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node_pointer            __node_pointer;
1454*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node_base_pointer       __node_base_pointer;
1455*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__parent_pointer          __parent_pointer;
1456*58b9f456SAndroid Build Coastguard Worker
1457*58b9f456SAndroid Build Coastguard Worker    typedef __map_node_destructor<__node_allocator> _Dp;
1458*58b9f456SAndroid Build Coastguard Worker    typedef unique_ptr<__node, _Dp> __node_holder;
1459*58b9f456SAndroid Build Coastguard Worker
1460*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_CXX03_LANG
1461*58b9f456SAndroid Build Coastguard Worker    __node_holder __construct_node_with_key(const key_type& __k);
1462*58b9f456SAndroid Build Coastguard Worker#endif
1463*58b9f456SAndroid Build Coastguard Worker};
1464*58b9f456SAndroid Build Coastguard Worker
1465*58b9f456SAndroid Build Coastguard Worker
1466*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1467*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1468*58b9f456SAndroid Build Coastguard Workermap<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
1469*58b9f456SAndroid Build Coastguard Worker    : __tree_(_VSTD::move(__m.__tree_), typename __base::allocator_type(__a))
1470*58b9f456SAndroid Build Coastguard Worker{
1471*58b9f456SAndroid Build Coastguard Worker    if (__a != __m.get_allocator())
1472*58b9f456SAndroid Build Coastguard Worker    {
1473*58b9f456SAndroid Build Coastguard Worker        const_iterator __e = cend();
1474*58b9f456SAndroid Build Coastguard Worker        while (!__m.empty())
1475*58b9f456SAndroid Build Coastguard Worker            __tree_.__insert_unique(__e.__i_,
1476*58b9f456SAndroid Build Coastguard Worker                    __m.__tree_.remove(__m.begin().__i_)->__value_.__move());
1477*58b9f456SAndroid Build Coastguard Worker    }
1478*58b9f456SAndroid Build Coastguard Worker}
1479*58b9f456SAndroid Build Coastguard Worker
1480*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1481*58b9f456SAndroid Build Coastguard Worker_Tp&
1482*58b9f456SAndroid Build Coastguard Workermap<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
1483*58b9f456SAndroid Build Coastguard Worker{
1484*58b9f456SAndroid Build Coastguard Worker    return __tree_.__emplace_unique_key_args(__k,
1485*58b9f456SAndroid Build Coastguard Worker        _VSTD::piecewise_construct,
1486*58b9f456SAndroid Build Coastguard Worker        _VSTD::forward_as_tuple(__k),
1487*58b9f456SAndroid Build Coastguard Worker        _VSTD::forward_as_tuple()).first->__get_value().second;
1488*58b9f456SAndroid Build Coastguard Worker}
1489*58b9f456SAndroid Build Coastguard Worker
1490*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1491*58b9f456SAndroid Build Coastguard Worker_Tp&
1492*58b9f456SAndroid Build Coastguard Workermap<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
1493*58b9f456SAndroid Build Coastguard Worker{
1494*58b9f456SAndroid Build Coastguard Worker    return __tree_.__emplace_unique_key_args(__k,
1495*58b9f456SAndroid Build Coastguard Worker        _VSTD::piecewise_construct,
1496*58b9f456SAndroid Build Coastguard Worker        _VSTD::forward_as_tuple(_VSTD::move(__k)),
1497*58b9f456SAndroid Build Coastguard Worker        _VSTD::forward_as_tuple()).first->__get_value().second;
1498*58b9f456SAndroid Build Coastguard Worker}
1499*58b9f456SAndroid Build Coastguard Worker
1500*58b9f456SAndroid Build Coastguard Worker#else // _LIBCPP_CXX03_LANG
1501*58b9f456SAndroid Build Coastguard Worker
1502*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1503*58b9f456SAndroid Build Coastguard Workertypename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
1504*58b9f456SAndroid Build Coastguard Workermap<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type& __k)
1505*58b9f456SAndroid Build Coastguard Worker{
1506*58b9f456SAndroid Build Coastguard Worker    __node_allocator& __na = __tree_.__node_alloc();
1507*58b9f456SAndroid Build Coastguard Worker    __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1508*58b9f456SAndroid Build Coastguard Worker    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().first), __k);
1509*58b9f456SAndroid Build Coastguard Worker    __h.get_deleter().__first_constructed = true;
1510*58b9f456SAndroid Build Coastguard Worker    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second));
1511*58b9f456SAndroid Build Coastguard Worker    __h.get_deleter().__second_constructed = true;
1512*58b9f456SAndroid Build Coastguard Worker    return _LIBCPP_EXPLICIT_MOVE(__h);  // explicitly moved for C++03
1513*58b9f456SAndroid Build Coastguard Worker}
1514*58b9f456SAndroid Build Coastguard Worker
1515*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1516*58b9f456SAndroid Build Coastguard Worker_Tp&
1517*58b9f456SAndroid Build Coastguard Workermap<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
1518*58b9f456SAndroid Build Coastguard Worker{
1519*58b9f456SAndroid Build Coastguard Worker    __parent_pointer __parent;
1520*58b9f456SAndroid Build Coastguard Worker    __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
1521*58b9f456SAndroid Build Coastguard Worker    __node_pointer __r = static_cast<__node_pointer>(__child);
1522*58b9f456SAndroid Build Coastguard Worker    if (__child == nullptr)
1523*58b9f456SAndroid Build Coastguard Worker    {
1524*58b9f456SAndroid Build Coastguard Worker        __node_holder __h = __construct_node_with_key(__k);
1525*58b9f456SAndroid Build Coastguard Worker        __tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
1526*58b9f456SAndroid Build Coastguard Worker        __r = __h.release();
1527*58b9f456SAndroid Build Coastguard Worker    }
1528*58b9f456SAndroid Build Coastguard Worker    return __r->__value_.__get_value().second;
1529*58b9f456SAndroid Build Coastguard Worker}
1530*58b9f456SAndroid Build Coastguard Worker
1531*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
1532*58b9f456SAndroid Build Coastguard Worker
1533*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1534*58b9f456SAndroid Build Coastguard Worker_Tp&
1535*58b9f456SAndroid Build Coastguard Workermap<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)
1536*58b9f456SAndroid Build Coastguard Worker{
1537*58b9f456SAndroid Build Coastguard Worker    __parent_pointer __parent;
1538*58b9f456SAndroid Build Coastguard Worker    __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
1539*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS
1540*58b9f456SAndroid Build Coastguard Worker    if (__child == nullptr)
1541*58b9f456SAndroid Build Coastguard Worker        throw out_of_range("map::at:  key not found");
1542*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_NO_EXCEPTIONS
1543*58b9f456SAndroid Build Coastguard Worker    return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
1544*58b9f456SAndroid Build Coastguard Worker}
1545*58b9f456SAndroid Build Coastguard Worker
1546*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1547*58b9f456SAndroid Build Coastguard Workerconst _Tp&
1548*58b9f456SAndroid Build Coastguard Workermap<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
1549*58b9f456SAndroid Build Coastguard Worker{
1550*58b9f456SAndroid Build Coastguard Worker    __parent_pointer __parent;
1551*58b9f456SAndroid Build Coastguard Worker    __node_base_pointer __child = __tree_.__find_equal(__parent, __k);
1552*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_EXCEPTIONS
1553*58b9f456SAndroid Build Coastguard Worker    if (__child == nullptr)
1554*58b9f456SAndroid Build Coastguard Worker        throw out_of_range("map::at:  key not found");
1555*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_NO_EXCEPTIONS
1556*58b9f456SAndroid Build Coastguard Worker    return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
1557*58b9f456SAndroid Build Coastguard Worker}
1558*58b9f456SAndroid Build Coastguard Worker
1559*58b9f456SAndroid Build Coastguard Worker
1560*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1561*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1562*58b9f456SAndroid Build Coastguard Workerbool
1563*58b9f456SAndroid Build Coastguard Workeroperator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1564*58b9f456SAndroid Build Coastguard Worker           const map<_Key, _Tp, _Compare, _Allocator>& __y)
1565*58b9f456SAndroid Build Coastguard Worker{
1566*58b9f456SAndroid Build Coastguard Worker    return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
1567*58b9f456SAndroid Build Coastguard Worker}
1568*58b9f456SAndroid Build Coastguard Worker
1569*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1570*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1571*58b9f456SAndroid Build Coastguard Workerbool
1572*58b9f456SAndroid Build Coastguard Workeroperator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
1573*58b9f456SAndroid Build Coastguard Worker           const map<_Key, _Tp, _Compare, _Allocator>& __y)
1574*58b9f456SAndroid Build Coastguard Worker{
1575*58b9f456SAndroid Build Coastguard Worker    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
1576*58b9f456SAndroid Build Coastguard Worker}
1577*58b9f456SAndroid Build Coastguard Worker
1578*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1579*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1580*58b9f456SAndroid Build Coastguard Workerbool
1581*58b9f456SAndroid Build Coastguard Workeroperator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1582*58b9f456SAndroid Build Coastguard Worker           const map<_Key, _Tp, _Compare, _Allocator>& __y)
1583*58b9f456SAndroid Build Coastguard Worker{
1584*58b9f456SAndroid Build Coastguard Worker    return !(__x == __y);
1585*58b9f456SAndroid Build Coastguard Worker}
1586*58b9f456SAndroid Build Coastguard Worker
1587*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1588*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1589*58b9f456SAndroid Build Coastguard Workerbool
1590*58b9f456SAndroid Build Coastguard Workeroperator> (const map<_Key, _Tp, _Compare, _Allocator>& __x,
1591*58b9f456SAndroid Build Coastguard Worker           const map<_Key, _Tp, _Compare, _Allocator>& __y)
1592*58b9f456SAndroid Build Coastguard Worker{
1593*58b9f456SAndroid Build Coastguard Worker    return __y < __x;
1594*58b9f456SAndroid Build Coastguard Worker}
1595*58b9f456SAndroid Build Coastguard Worker
1596*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1597*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1598*58b9f456SAndroid Build Coastguard Workerbool
1599*58b9f456SAndroid Build Coastguard Workeroperator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1600*58b9f456SAndroid Build Coastguard Worker           const map<_Key, _Tp, _Compare, _Allocator>& __y)
1601*58b9f456SAndroid Build Coastguard Worker{
1602*58b9f456SAndroid Build Coastguard Worker    return !(__x < __y);
1603*58b9f456SAndroid Build Coastguard Worker}
1604*58b9f456SAndroid Build Coastguard Worker
1605*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1606*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1607*58b9f456SAndroid Build Coastguard Workerbool
1608*58b9f456SAndroid Build Coastguard Workeroperator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1609*58b9f456SAndroid Build Coastguard Worker           const map<_Key, _Tp, _Compare, _Allocator>& __y)
1610*58b9f456SAndroid Build Coastguard Worker{
1611*58b9f456SAndroid Build Coastguard Worker    return !(__y < __x);
1612*58b9f456SAndroid Build Coastguard Worker}
1613*58b9f456SAndroid Build Coastguard Worker
1614*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
1615*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1616*58b9f456SAndroid Build Coastguard Workervoid
1617*58b9f456SAndroid Build Coastguard Workerswap(map<_Key, _Tp, _Compare, _Allocator>& __x,
1618*58b9f456SAndroid Build Coastguard Worker     map<_Key, _Tp, _Compare, _Allocator>& __y)
1619*58b9f456SAndroid Build Coastguard Worker    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
1620*58b9f456SAndroid Build Coastguard Worker{
1621*58b9f456SAndroid Build Coastguard Worker    __x.swap(__y);
1622*58b9f456SAndroid Build Coastguard Worker}
1623*58b9f456SAndroid Build Coastguard Worker
1624*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 17
1625*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
1626*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
1627*58b9f456SAndroid Build Coastguard Workervoid erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred)
1628*58b9f456SAndroid Build Coastguard Worker{ __libcpp_erase_if_container(__c, __pred); }
1629*58b9f456SAndroid Build Coastguard Worker#endif
1630*58b9f456SAndroid Build Coastguard Worker
1631*58b9f456SAndroid Build Coastguard Worker
1632*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare = less<_Key>,
1633*58b9f456SAndroid Build Coastguard Worker          class _Allocator = allocator<pair<const _Key, _Tp> > >
1634*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS multimap
1635*58b9f456SAndroid Build Coastguard Worker{
1636*58b9f456SAndroid Build Coastguard Workerpublic:
1637*58b9f456SAndroid Build Coastguard Worker    // types:
1638*58b9f456SAndroid Build Coastguard Worker    typedef _Key                                     key_type;
1639*58b9f456SAndroid Build Coastguard Worker    typedef _Tp                                      mapped_type;
1640*58b9f456SAndroid Build Coastguard Worker    typedef pair<const key_type, mapped_type>        value_type;
1641*58b9f456SAndroid Build Coastguard Worker    typedef _Compare                                 key_compare;
1642*58b9f456SAndroid Build Coastguard Worker    typedef _Allocator                               allocator_type;
1643*58b9f456SAndroid Build Coastguard Worker    typedef value_type&                              reference;
1644*58b9f456SAndroid Build Coastguard Worker    typedef const value_type&                        const_reference;
1645*58b9f456SAndroid Build Coastguard Worker
1646*58b9f456SAndroid Build Coastguard Worker    static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
1647*58b9f456SAndroid Build Coastguard Worker    static_assert((is_same<typename allocator_type::value_type, value_type>::value),
1648*58b9f456SAndroid Build Coastguard Worker                  "Allocator::value_type must be same type as value_type");
1649*58b9f456SAndroid Build Coastguard Worker
1650*58b9f456SAndroid Build Coastguard Worker    class _LIBCPP_TEMPLATE_VIS value_compare
1651*58b9f456SAndroid Build Coastguard Worker        : public binary_function<value_type, value_type, bool>
1652*58b9f456SAndroid Build Coastguard Worker    {
1653*58b9f456SAndroid Build Coastguard Worker        friend class multimap;
1654*58b9f456SAndroid Build Coastguard Worker    protected:
1655*58b9f456SAndroid Build Coastguard Worker        key_compare comp;
1656*58b9f456SAndroid Build Coastguard Worker
1657*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1658*58b9f456SAndroid Build Coastguard Worker        value_compare(key_compare c) : comp(c) {}
1659*58b9f456SAndroid Build Coastguard Worker    public:
1660*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1661*58b9f456SAndroid Build Coastguard Worker        bool operator()(const value_type& __x, const value_type& __y) const
1662*58b9f456SAndroid Build Coastguard Worker            {return comp(__x.first, __y.first);}
1663*58b9f456SAndroid Build Coastguard Worker    };
1664*58b9f456SAndroid Build Coastguard Worker
1665*58b9f456SAndroid Build Coastguard Workerprivate:
1666*58b9f456SAndroid Build Coastguard Worker
1667*58b9f456SAndroid Build Coastguard Worker    typedef _VSTD::__value_type<key_type, mapped_type>             __value_type;
1668*58b9f456SAndroid Build Coastguard Worker    typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
1669*58b9f456SAndroid Build Coastguard Worker    typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
1670*58b9f456SAndroid Build Coastguard Worker                                                 __value_type>::type __allocator_type;
1671*58b9f456SAndroid Build Coastguard Worker    typedef __tree<__value_type, __vc, __allocator_type>            __base;
1672*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node_traits                          __node_traits;
1673*58b9f456SAndroid Build Coastguard Worker    typedef allocator_traits<allocator_type>                        __alloc_traits;
1674*58b9f456SAndroid Build Coastguard Worker
1675*58b9f456SAndroid Build Coastguard Worker    __base __tree_;
1676*58b9f456SAndroid Build Coastguard Worker
1677*58b9f456SAndroid Build Coastguard Workerpublic:
1678*58b9f456SAndroid Build Coastguard Worker    typedef typename __alloc_traits::pointer               pointer;
1679*58b9f456SAndroid Build Coastguard Worker    typedef typename __alloc_traits::const_pointer         const_pointer;
1680*58b9f456SAndroid Build Coastguard Worker    typedef typename __alloc_traits::size_type             size_type;
1681*58b9f456SAndroid Build Coastguard Worker    typedef typename __alloc_traits::difference_type       difference_type;
1682*58b9f456SAndroid Build Coastguard Worker    typedef __map_iterator<typename __base::iterator>      iterator;
1683*58b9f456SAndroid Build Coastguard Worker    typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
1684*58b9f456SAndroid Build Coastguard Worker    typedef _VSTD::reverse_iterator<iterator>               reverse_iterator;
1685*58b9f456SAndroid Build Coastguard Worker    typedef _VSTD::reverse_iterator<const_iterator>         const_reverse_iterator;
1686*58b9f456SAndroid Build Coastguard Worker
1687*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
1688*58b9f456SAndroid Build Coastguard Worker    typedef __map_node_handle<typename __base::__node, allocator_type> node_type;
1689*58b9f456SAndroid Build Coastguard Worker#endif
1690*58b9f456SAndroid Build Coastguard Worker
1691*58b9f456SAndroid Build Coastguard Worker    template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
1692*58b9f456SAndroid Build Coastguard Worker        friend class _LIBCPP_TEMPLATE_VIS map;
1693*58b9f456SAndroid Build Coastguard Worker    template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
1694*58b9f456SAndroid Build Coastguard Worker        friend class _LIBCPP_TEMPLATE_VIS multimap;
1695*58b9f456SAndroid Build Coastguard Worker
1696*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1697*58b9f456SAndroid Build Coastguard Worker    multimap()
1698*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(
1699*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
1700*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<key_compare>::value &&
1701*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value)
1702*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(key_compare())) {}
1703*58b9f456SAndroid Build Coastguard Worker
1704*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1705*58b9f456SAndroid Build Coastguard Worker    explicit multimap(const key_compare& __comp)
1706*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(
1707*58b9f456SAndroid Build Coastguard Worker            is_nothrow_default_constructible<allocator_type>::value &&
1708*58b9f456SAndroid Build Coastguard Worker            is_nothrow_copy_constructible<key_compare>::value)
1709*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp)) {}
1710*58b9f456SAndroid Build Coastguard Worker
1711*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1712*58b9f456SAndroid Build Coastguard Worker    explicit multimap(const key_compare& __comp, const allocator_type& __a)
1713*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
1714*58b9f456SAndroid Build Coastguard Worker
1715*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
1716*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1717*58b9f456SAndroid Build Coastguard Worker        multimap(_InputIterator __f, _InputIterator __l,
1718*58b9f456SAndroid Build Coastguard Worker            const key_compare& __comp = key_compare())
1719*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp))
1720*58b9f456SAndroid Build Coastguard Worker        {
1721*58b9f456SAndroid Build Coastguard Worker            insert(__f, __l);
1722*58b9f456SAndroid Build Coastguard Worker        }
1723*58b9f456SAndroid Build Coastguard Worker
1724*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
1725*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1726*58b9f456SAndroid Build Coastguard Worker        multimap(_InputIterator __f, _InputIterator __l,
1727*58b9f456SAndroid Build Coastguard Worker            const key_compare& __comp, const allocator_type& __a)
1728*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp), typename __base::allocator_type(__a))
1729*58b9f456SAndroid Build Coastguard Worker        {
1730*58b9f456SAndroid Build Coastguard Worker            insert(__f, __l);
1731*58b9f456SAndroid Build Coastguard Worker        }
1732*58b9f456SAndroid Build Coastguard Worker
1733*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1734*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
1735*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1736*58b9f456SAndroid Build Coastguard Worker    multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
1737*58b9f456SAndroid Build Coastguard Worker        : multimap(__f, __l, key_compare(), __a) {}
1738*58b9f456SAndroid Build Coastguard Worker#endif
1739*58b9f456SAndroid Build Coastguard Worker
1740*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1741*58b9f456SAndroid Build Coastguard Worker    multimap(const multimap& __m)
1742*58b9f456SAndroid Build Coastguard Worker        : __tree_(__m.__tree_.value_comp(),
1743*58b9f456SAndroid Build Coastguard Worker          __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc()))
1744*58b9f456SAndroid Build Coastguard Worker        {
1745*58b9f456SAndroid Build Coastguard Worker            insert(__m.begin(), __m.end());
1746*58b9f456SAndroid Build Coastguard Worker        }
1747*58b9f456SAndroid Build Coastguard Worker
1748*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1749*58b9f456SAndroid Build Coastguard Worker    multimap& operator=(const multimap& __m)
1750*58b9f456SAndroid Build Coastguard Worker        {
1751*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1752*58b9f456SAndroid Build Coastguard Worker            __tree_ = __m.__tree_;
1753*58b9f456SAndroid Build Coastguard Worker#else
1754*58b9f456SAndroid Build Coastguard Worker            if (this != &__m) {
1755*58b9f456SAndroid Build Coastguard Worker                __tree_.clear();
1756*58b9f456SAndroid Build Coastguard Worker                __tree_.value_comp() = __m.__tree_.value_comp();
1757*58b9f456SAndroid Build Coastguard Worker                __tree_.__copy_assign_alloc(__m.__tree_);
1758*58b9f456SAndroid Build Coastguard Worker                insert(__m.begin(), __m.end());
1759*58b9f456SAndroid Build Coastguard Worker            }
1760*58b9f456SAndroid Build Coastguard Worker#endif
1761*58b9f456SAndroid Build Coastguard Worker            return *this;
1762*58b9f456SAndroid Build Coastguard Worker        }
1763*58b9f456SAndroid Build Coastguard Worker
1764*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1765*58b9f456SAndroid Build Coastguard Worker
1766*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1767*58b9f456SAndroid Build Coastguard Worker    multimap(multimap&& __m)
1768*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
1769*58b9f456SAndroid Build Coastguard Worker        : __tree_(_VSTD::move(__m.__tree_))
1770*58b9f456SAndroid Build Coastguard Worker        {
1771*58b9f456SAndroid Build Coastguard Worker        }
1772*58b9f456SAndroid Build Coastguard Worker
1773*58b9f456SAndroid Build Coastguard Worker    multimap(multimap&& __m, const allocator_type& __a);
1774*58b9f456SAndroid Build Coastguard Worker
1775*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1776*58b9f456SAndroid Build Coastguard Worker    multimap& operator=(multimap&& __m)
1777*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
1778*58b9f456SAndroid Build Coastguard Worker        {
1779*58b9f456SAndroid Build Coastguard Worker            __tree_ = _VSTD::move(__m.__tree_);
1780*58b9f456SAndroid Build Coastguard Worker            return *this;
1781*58b9f456SAndroid Build Coastguard Worker        }
1782*58b9f456SAndroid Build Coastguard Worker
1783*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1784*58b9f456SAndroid Build Coastguard Worker    multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
1785*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp))
1786*58b9f456SAndroid Build Coastguard Worker        {
1787*58b9f456SAndroid Build Coastguard Worker            insert(__il.begin(), __il.end());
1788*58b9f456SAndroid Build Coastguard Worker        }
1789*58b9f456SAndroid Build Coastguard Worker
1790*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1791*58b9f456SAndroid Build Coastguard Worker    multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
1792*58b9f456SAndroid Build Coastguard Worker        : __tree_(__vc(__comp), typename __base::allocator_type(__a))
1793*58b9f456SAndroid Build Coastguard Worker        {
1794*58b9f456SAndroid Build Coastguard Worker            insert(__il.begin(), __il.end());
1795*58b9f456SAndroid Build Coastguard Worker        }
1796*58b9f456SAndroid Build Coastguard Worker
1797*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
1798*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1799*58b9f456SAndroid Build Coastguard Worker    multimap(initializer_list<value_type> __il, const allocator_type& __a)
1800*58b9f456SAndroid Build Coastguard Worker        : multimap(__il, key_compare(), __a) {}
1801*58b9f456SAndroid Build Coastguard Worker#endif
1802*58b9f456SAndroid Build Coastguard Worker
1803*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1804*58b9f456SAndroid Build Coastguard Worker    multimap& operator=(initializer_list<value_type> __il)
1805*58b9f456SAndroid Build Coastguard Worker        {
1806*58b9f456SAndroid Build Coastguard Worker            __tree_.__assign_multi(__il.begin(), __il.end());
1807*58b9f456SAndroid Build Coastguard Worker            return *this;
1808*58b9f456SAndroid Build Coastguard Worker        }
1809*58b9f456SAndroid Build Coastguard Worker
1810*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
1811*58b9f456SAndroid Build Coastguard Worker
1812*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1813*58b9f456SAndroid Build Coastguard Worker    explicit multimap(const allocator_type& __a)
1814*58b9f456SAndroid Build Coastguard Worker        : __tree_(typename __base::allocator_type(__a))
1815*58b9f456SAndroid Build Coastguard Worker        {
1816*58b9f456SAndroid Build Coastguard Worker        }
1817*58b9f456SAndroid Build Coastguard Worker
1818*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1819*58b9f456SAndroid Build Coastguard Worker    multimap(const multimap& __m, const allocator_type& __a)
1820*58b9f456SAndroid Build Coastguard Worker        : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a))
1821*58b9f456SAndroid Build Coastguard Worker        {
1822*58b9f456SAndroid Build Coastguard Worker            insert(__m.begin(), __m.end());
1823*58b9f456SAndroid Build Coastguard Worker        }
1824*58b9f456SAndroid Build Coastguard Worker
1825*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1826*58b9f456SAndroid Build Coastguard Worker          iterator begin() _NOEXCEPT {return __tree_.begin();}
1827*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1828*58b9f456SAndroid Build Coastguard Worker    const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
1829*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1830*58b9f456SAndroid Build Coastguard Worker          iterator end() _NOEXCEPT {return __tree_.end();}
1831*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1832*58b9f456SAndroid Build Coastguard Worker    const_iterator end() const _NOEXCEPT {return __tree_.end();}
1833*58b9f456SAndroid Build Coastguard Worker
1834*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1835*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
1836*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1837*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rbegin() const _NOEXCEPT
1838*58b9f456SAndroid Build Coastguard Worker        {return const_reverse_iterator(end());}
1839*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1840*58b9f456SAndroid Build Coastguard Worker          reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
1841*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1842*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator rend() const _NOEXCEPT
1843*58b9f456SAndroid Build Coastguard Worker        {return const_reverse_iterator(begin());}
1844*58b9f456SAndroid Build Coastguard Worker
1845*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1846*58b9f456SAndroid Build Coastguard Worker    const_iterator cbegin()  const _NOEXCEPT {return begin();}
1847*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1848*58b9f456SAndroid Build Coastguard Worker    const_iterator cend() const _NOEXCEPT {return end();}
1849*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1850*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
1851*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1852*58b9f456SAndroid Build Coastguard Worker    const_reverse_iterator crend() const _NOEXCEPT {return rend();}
1853*58b9f456SAndroid Build Coastguard Worker
1854*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
1855*58b9f456SAndroid Build Coastguard Worker    bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
1856*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1857*58b9f456SAndroid Build Coastguard Worker    size_type size() const _NOEXCEPT {return __tree_.size();}
1858*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1859*58b9f456SAndroid Build Coastguard Worker    size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
1860*58b9f456SAndroid Build Coastguard Worker
1861*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1862*58b9f456SAndroid Build Coastguard Worker    allocator_type get_allocator() const _NOEXCEPT {return allocator_type(__tree_.__alloc());}
1863*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1864*58b9f456SAndroid Build Coastguard Worker    key_compare    key_comp() const {return __tree_.value_comp().key_comp();}
1865*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1866*58b9f456SAndroid Build Coastguard Worker    value_compare  value_comp() const
1867*58b9f456SAndroid Build Coastguard Worker        {return value_compare(__tree_.value_comp().key_comp());}
1868*58b9f456SAndroid Build Coastguard Worker
1869*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
1870*58b9f456SAndroid Build Coastguard Worker
1871*58b9f456SAndroid Build Coastguard Worker    template <class ..._Args>
1872*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1873*58b9f456SAndroid Build Coastguard Worker    iterator emplace(_Args&& ...__args) {
1874*58b9f456SAndroid Build Coastguard Worker        return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);
1875*58b9f456SAndroid Build Coastguard Worker    }
1876*58b9f456SAndroid Build Coastguard Worker
1877*58b9f456SAndroid Build Coastguard Worker    template <class ..._Args>
1878*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1879*58b9f456SAndroid Build Coastguard Worker    iterator emplace_hint(const_iterator __p, _Args&& ...__args) {
1880*58b9f456SAndroid Build Coastguard Worker        return __tree_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_Args>(__args)...);
1881*58b9f456SAndroid Build Coastguard Worker    }
1882*58b9f456SAndroid Build Coastguard Worker
1883*58b9f456SAndroid Build Coastguard Worker    template <class _Pp,
1884*58b9f456SAndroid Build Coastguard Worker              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
1885*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1886*58b9f456SAndroid Build Coastguard Worker        iterator insert(_Pp&& __p)
1887*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__insert_multi(_VSTD::forward<_Pp>(__p));}
1888*58b9f456SAndroid Build Coastguard Worker
1889*58b9f456SAndroid Build Coastguard Worker    template <class _Pp,
1890*58b9f456SAndroid Build Coastguard Worker              class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
1891*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1892*58b9f456SAndroid Build Coastguard Worker        iterator insert(const_iterator __pos, _Pp&& __p)
1893*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_Pp>(__p));}
1894*58b9f456SAndroid Build Coastguard Worker
1895*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1896*58b9f456SAndroid Build Coastguard Worker    iterator insert(value_type&& __v)
1897*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__insert_multi(_VSTD::move(__v));}
1898*58b9f456SAndroid Build Coastguard Worker
1899*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1900*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __p, value_type&& __v)
1901*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__insert_multi(__p.__i_, _VSTD::move(__v));}
1902*58b9f456SAndroid Build Coastguard Worker
1903*58b9f456SAndroid Build Coastguard Worker
1904*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1905*58b9f456SAndroid Build Coastguard Worker    void insert(initializer_list<value_type> __il)
1906*58b9f456SAndroid Build Coastguard Worker        {insert(__il.begin(), __il.end());}
1907*58b9f456SAndroid Build Coastguard Worker
1908*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
1909*58b9f456SAndroid Build Coastguard Worker
1910*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1911*58b9f456SAndroid Build Coastguard Worker    iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);}
1912*58b9f456SAndroid Build Coastguard Worker
1913*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1914*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __p, const value_type& __v)
1915*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__insert_multi(__p.__i_, __v);}
1916*58b9f456SAndroid Build Coastguard Worker
1917*58b9f456SAndroid Build Coastguard Worker    template <class _InputIterator>
1918*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
1919*58b9f456SAndroid Build Coastguard Worker        void insert(_InputIterator __f, _InputIterator __l)
1920*58b9f456SAndroid Build Coastguard Worker        {
1921*58b9f456SAndroid Build Coastguard Worker            for (const_iterator __e = cend(); __f != __l; ++__f)
1922*58b9f456SAndroid Build Coastguard Worker                __tree_.__insert_multi(__e.__i_, *__f);
1923*58b9f456SAndroid Build Coastguard Worker        }
1924*58b9f456SAndroid Build Coastguard Worker
1925*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1926*58b9f456SAndroid Build Coastguard Worker    iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
1927*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1928*58b9f456SAndroid Build Coastguard Worker    iterator erase(iterator __p)       {return __tree_.erase(__p.__i_);}
1929*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1930*58b9f456SAndroid Build Coastguard Worker    size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
1931*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1932*58b9f456SAndroid Build Coastguard Worker    iterator  erase(const_iterator __f, const_iterator __l)
1933*58b9f456SAndroid Build Coastguard Worker        {return __tree_.erase(__f.__i_, __l.__i_);}
1934*58b9f456SAndroid Build Coastguard Worker
1935*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
1936*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1937*58b9f456SAndroid Build Coastguard Worker    iterator insert(node_type&& __nh)
1938*58b9f456SAndroid Build Coastguard Worker    {
1939*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
1940*58b9f456SAndroid Build Coastguard Worker            "node_type with incompatible allocator passed to multimap::insert()");
1941*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_insert_multi<node_type>(
1942*58b9f456SAndroid Build Coastguard Worker            _VSTD::move(__nh));
1943*58b9f456SAndroid Build Coastguard Worker    }
1944*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1945*58b9f456SAndroid Build Coastguard Worker    iterator insert(const_iterator __hint, node_type&& __nh)
1946*58b9f456SAndroid Build Coastguard Worker    {
1947*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),
1948*58b9f456SAndroid Build Coastguard Worker            "node_type with incompatible allocator passed to multimap::insert()");
1949*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_insert_multi<node_type>(
1950*58b9f456SAndroid Build Coastguard Worker            __hint.__i_, _VSTD::move(__nh));
1951*58b9f456SAndroid Build Coastguard Worker    }
1952*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1953*58b9f456SAndroid Build Coastguard Worker    node_type extract(key_type const& __key)
1954*58b9f456SAndroid Build Coastguard Worker    {
1955*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_extract<node_type>(__key);
1956*58b9f456SAndroid Build Coastguard Worker    }
1957*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1958*58b9f456SAndroid Build Coastguard Worker    node_type extract(const_iterator __it)
1959*58b9f456SAndroid Build Coastguard Worker    {
1960*58b9f456SAndroid Build Coastguard Worker        return __tree_.template __node_handle_extract<node_type>(
1961*58b9f456SAndroid Build Coastguard Worker            __it.__i_);
1962*58b9f456SAndroid Build Coastguard Worker    }
1963*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1964*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1965*58b9f456SAndroid Build Coastguard Worker    void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source)
1966*58b9f456SAndroid Build Coastguard Worker    {
1967*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1968*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1969*58b9f456SAndroid Build Coastguard Worker        return __tree_.__node_handle_merge_multi(__source.__tree_);
1970*58b9f456SAndroid Build Coastguard Worker    }
1971*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1972*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1973*58b9f456SAndroid Build Coastguard Worker    void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source)
1974*58b9f456SAndroid Build Coastguard Worker    {
1975*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1976*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1977*58b9f456SAndroid Build Coastguard Worker        return __tree_.__node_handle_merge_multi(__source.__tree_);
1978*58b9f456SAndroid Build Coastguard Worker    }
1979*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1980*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1981*58b9f456SAndroid Build Coastguard Worker    void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source)
1982*58b9f456SAndroid Build Coastguard Worker    {
1983*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1984*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1985*58b9f456SAndroid Build Coastguard Worker        return __tree_.__node_handle_merge_multi(__source.__tree_);
1986*58b9f456SAndroid Build Coastguard Worker    }
1987*58b9f456SAndroid Build Coastguard Worker    template <class _Compare2>
1988*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1989*58b9f456SAndroid Build Coastguard Worker    void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source)
1990*58b9f456SAndroid Build Coastguard Worker    {
1991*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(),
1992*58b9f456SAndroid Build Coastguard Worker                       "merging container with incompatible allocator");
1993*58b9f456SAndroid Build Coastguard Worker        return __tree_.__node_handle_merge_multi(__source.__tree_);
1994*58b9f456SAndroid Build Coastguard Worker    }
1995*58b9f456SAndroid Build Coastguard Worker#endif
1996*58b9f456SAndroid Build Coastguard Worker
1997*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
1998*58b9f456SAndroid Build Coastguard Worker    void clear() _NOEXCEPT {__tree_.clear();}
1999*58b9f456SAndroid Build Coastguard Worker
2000*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2001*58b9f456SAndroid Build Coastguard Worker    void swap(multimap& __m)
2002*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
2003*58b9f456SAndroid Build Coastguard Worker        {__tree_.swap(__m.__tree_);}
2004*58b9f456SAndroid Build Coastguard Worker
2005*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2006*58b9f456SAndroid Build Coastguard Worker    iterator find(const key_type& __k)             {return __tree_.find(__k);}
2007*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2008*58b9f456SAndroid Build Coastguard Worker    const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
2009*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
2010*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
2011*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2012*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
2013*58b9f456SAndroid Build Coastguard Worker    find(const _K2& __k)                           {return __tree_.find(__k);}
2014*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
2015*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2016*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
2017*58b9f456SAndroid Build Coastguard Worker    find(const _K2& __k) const                     {return __tree_.find(__k);}
2018*58b9f456SAndroid Build Coastguard Worker#endif
2019*58b9f456SAndroid Build Coastguard Worker
2020*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2021*58b9f456SAndroid Build Coastguard Worker    size_type      count(const key_type& __k) const
2022*58b9f456SAndroid Build Coastguard Worker        {return __tree_.__count_multi(__k);}
2023*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
2024*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
2025*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2026*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
2027*58b9f456SAndroid Build Coastguard Worker    count(const _K2& __k) const {return __tree_.__count_multi(__k);}
2028*58b9f456SAndroid Build Coastguard Worker#endif
2029*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2030*58b9f456SAndroid Build Coastguard Worker    iterator lower_bound(const key_type& __k)
2031*58b9f456SAndroid Build Coastguard Worker        {return __tree_.lower_bound(__k);}
2032*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2033*58b9f456SAndroid Build Coastguard Worker    const_iterator lower_bound(const key_type& __k) const
2034*58b9f456SAndroid Build Coastguard Worker            {return __tree_.lower_bound(__k);}
2035*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
2036*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
2037*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2038*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
2039*58b9f456SAndroid Build Coastguard Worker    lower_bound(const _K2& __k)       {return __tree_.lower_bound(__k);}
2040*58b9f456SAndroid Build Coastguard Worker
2041*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
2042*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2043*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
2044*58b9f456SAndroid Build Coastguard Worker    lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
2045*58b9f456SAndroid Build Coastguard Worker#endif
2046*58b9f456SAndroid Build Coastguard Worker
2047*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2048*58b9f456SAndroid Build Coastguard Worker    iterator upper_bound(const key_type& __k)
2049*58b9f456SAndroid Build Coastguard Worker            {return __tree_.upper_bound(__k);}
2050*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2051*58b9f456SAndroid Build Coastguard Worker    const_iterator upper_bound(const key_type& __k) const
2052*58b9f456SAndroid Build Coastguard Worker            {return __tree_.upper_bound(__k);}
2053*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
2054*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
2055*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2056*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
2057*58b9f456SAndroid Build Coastguard Worker    upper_bound(const _K2& __k)       {return __tree_.upper_bound(__k);}
2058*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
2059*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2060*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
2061*58b9f456SAndroid Build Coastguard Worker    upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
2062*58b9f456SAndroid Build Coastguard Worker#endif
2063*58b9f456SAndroid Build Coastguard Worker
2064*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2065*58b9f456SAndroid Build Coastguard Worker    pair<iterator,iterator>             equal_range(const key_type& __k)
2066*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__equal_range_multi(__k);}
2067*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2068*58b9f456SAndroid Build Coastguard Worker    pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
2069*58b9f456SAndroid Build Coastguard Worker            {return __tree_.__equal_range_multi(__k);}
2070*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11
2071*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
2072*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2073*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
2074*58b9f456SAndroid Build Coastguard Worker    equal_range(const _K2& __k)       {return __tree_.__equal_range_multi(__k);}
2075*58b9f456SAndroid Build Coastguard Worker    template <typename _K2>
2076*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
2077*58b9f456SAndroid Build Coastguard Worker    typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
2078*58b9f456SAndroid Build Coastguard Worker    equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
2079*58b9f456SAndroid Build Coastguard Worker#endif
2080*58b9f456SAndroid Build Coastguard Worker
2081*58b9f456SAndroid Build Coastguard Workerprivate:
2082*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node                    __node;
2083*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node_allocator          __node_allocator;
2084*58b9f456SAndroid Build Coastguard Worker    typedef typename __base::__node_pointer            __node_pointer;
2085*58b9f456SAndroid Build Coastguard Worker
2086*58b9f456SAndroid Build Coastguard Worker    typedef __map_node_destructor<__node_allocator> _Dp;
2087*58b9f456SAndroid Build Coastguard Worker    typedef unique_ptr<__node, _Dp> __node_holder;
2088*58b9f456SAndroid Build Coastguard Worker};
2089*58b9f456SAndroid Build Coastguard Worker
2090*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
2091*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
2092*58b9f456SAndroid Build Coastguard Workermultimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
2093*58b9f456SAndroid Build Coastguard Worker    : __tree_(_VSTD::move(__m.__tree_), typename __base::allocator_type(__a))
2094*58b9f456SAndroid Build Coastguard Worker{
2095*58b9f456SAndroid Build Coastguard Worker    if (__a != __m.get_allocator())
2096*58b9f456SAndroid Build Coastguard Worker    {
2097*58b9f456SAndroid Build Coastguard Worker        const_iterator __e = cend();
2098*58b9f456SAndroid Build Coastguard Worker        while (!__m.empty())
2099*58b9f456SAndroid Build Coastguard Worker            __tree_.__insert_multi(__e.__i_,
2100*58b9f456SAndroid Build Coastguard Worker                    _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__move()));
2101*58b9f456SAndroid Build Coastguard Worker    }
2102*58b9f456SAndroid Build Coastguard Worker}
2103*58b9f456SAndroid Build Coastguard Worker#endif
2104*58b9f456SAndroid Build Coastguard Worker
2105*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
2106*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
2107*58b9f456SAndroid Build Coastguard Workerbool
2108*58b9f456SAndroid Build Coastguard Workeroperator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
2109*58b9f456SAndroid Build Coastguard Worker           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
2110*58b9f456SAndroid Build Coastguard Worker{
2111*58b9f456SAndroid Build Coastguard Worker    return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
2112*58b9f456SAndroid Build Coastguard Worker}
2113*58b9f456SAndroid Build Coastguard Worker
2114*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
2115*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
2116*58b9f456SAndroid Build Coastguard Workerbool
2117*58b9f456SAndroid Build Coastguard Workeroperator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
2118*58b9f456SAndroid Build Coastguard Worker           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
2119*58b9f456SAndroid Build Coastguard Worker{
2120*58b9f456SAndroid Build Coastguard Worker    return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
2121*58b9f456SAndroid Build Coastguard Worker}
2122*58b9f456SAndroid Build Coastguard Worker
2123*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
2124*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
2125*58b9f456SAndroid Build Coastguard Workerbool
2126*58b9f456SAndroid Build Coastguard Workeroperator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
2127*58b9f456SAndroid Build Coastguard Worker           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
2128*58b9f456SAndroid Build Coastguard Worker{
2129*58b9f456SAndroid Build Coastguard Worker    return !(__x == __y);
2130*58b9f456SAndroid Build Coastguard Worker}
2131*58b9f456SAndroid Build Coastguard Worker
2132*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
2133*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
2134*58b9f456SAndroid Build Coastguard Workerbool
2135*58b9f456SAndroid Build Coastguard Workeroperator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
2136*58b9f456SAndroid Build Coastguard Worker           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
2137*58b9f456SAndroid Build Coastguard Worker{
2138*58b9f456SAndroid Build Coastguard Worker    return __y < __x;
2139*58b9f456SAndroid Build Coastguard Worker}
2140*58b9f456SAndroid Build Coastguard Worker
2141*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
2142*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
2143*58b9f456SAndroid Build Coastguard Workerbool
2144*58b9f456SAndroid Build Coastguard Workeroperator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
2145*58b9f456SAndroid Build Coastguard Worker           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
2146*58b9f456SAndroid Build Coastguard Worker{
2147*58b9f456SAndroid Build Coastguard Worker    return !(__x < __y);
2148*58b9f456SAndroid Build Coastguard Worker}
2149*58b9f456SAndroid Build Coastguard Worker
2150*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
2151*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
2152*58b9f456SAndroid Build Coastguard Workerbool
2153*58b9f456SAndroid Build Coastguard Workeroperator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
2154*58b9f456SAndroid Build Coastguard Worker           const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
2155*58b9f456SAndroid Build Coastguard Worker{
2156*58b9f456SAndroid Build Coastguard Worker    return !(__y < __x);
2157*58b9f456SAndroid Build Coastguard Worker}
2158*58b9f456SAndroid Build Coastguard Worker
2159*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator>
2160*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
2161*58b9f456SAndroid Build Coastguard Workervoid
2162*58b9f456SAndroid Build Coastguard Workerswap(multimap<_Key, _Tp, _Compare, _Allocator>& __x,
2163*58b9f456SAndroid Build Coastguard Worker     multimap<_Key, _Tp, _Compare, _Allocator>& __y)
2164*58b9f456SAndroid Build Coastguard Worker    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
2165*58b9f456SAndroid Build Coastguard Worker{
2166*58b9f456SAndroid Build Coastguard Worker    __x.swap(__y);
2167*58b9f456SAndroid Build Coastguard Worker}
2168*58b9f456SAndroid Build Coastguard Worker
2169*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 17
2170*58b9f456SAndroid Build Coastguard Workertemplate <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
2171*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
2172*58b9f456SAndroid Build Coastguard Workervoid erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred)
2173*58b9f456SAndroid Build Coastguard Worker{ __libcpp_erase_if_container(__c, __pred); }
2174*58b9f456SAndroid Build Coastguard Worker#endif
2175*58b9f456SAndroid Build Coastguard Worker
2176*58b9f456SAndroid Build Coastguard Worker_LIBCPP_END_NAMESPACE_STD
2177*58b9f456SAndroid Build Coastguard Worker
2178*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_MAP
2179