2 //===----------------------------- map ------------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
21 template <class Key, class T, class Compare = less<Key>,
22 class Allocator = allocator<pair<const Key, T>>>
28 typedef T mapped_type;
29 typedef pair<const key_type, mapped_type> value_type;
30 typedef Compare key_compare;
31 typedef Allocator allocator_type;
32 typedef typename allocator_type::reference reference;
33 typedef typename allocator_type::const_reference const_reference;
34 typedef typename allocator_type::pointer pointer;
35 typedef typename allocator_type::const_pointer const_pointer;
36 typedef typename allocator_type::size_type size_type;
37 typedef typename allocator_type::difference_type difference_type;
39 typedef implementation-defined iterator;
40 typedef implementation-defined const_iterator;
41 typedef std::reverse_iterator<iterator> reverse_iterator;
42 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
45 : public binary_function<value_type, value_type, bool>
51 value_compare(key_compare c);
53 bool operator()(const value_type& x, const value_type& y) const;
56 // construct/copy/destroy:
59 is_nothrow_default_constructible<allocator_type>::value &&
60 is_nothrow_default_constructible<key_compare>::value &&
61 is_nothrow_copy_constructible<key_compare>::value);
62 explicit map(const key_compare& comp);
63 map(const key_compare& comp, const allocator_type& a);
64 template <class InputIterator>
65 map(InputIterator first, InputIterator last,
66 const key_compare& comp = key_compare());
67 template <class InputIterator>
68 map(InputIterator first, InputIterator last,
69 const key_compare& comp, const allocator_type& a);
73 is_nothrow_move_constructible<allocator_type>::value &&
74 is_nothrow_move_constructible<key_compare>::value);
75 explicit map(const allocator_type& a);
76 map(const map& m, const allocator_type& a);
77 map(map&& m, const allocator_type& a);
78 map(initializer_list<value_type> il, const key_compare& comp = key_compare());
79 map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
82 map& operator=(const map& m);
83 map& operator=(map&& m)
85 allocator_type::propagate_on_container_move_assignment::value &&
86 is_nothrow_move_assignable<allocator_type>::value &&
87 is_nothrow_move_assignable<key_compare>::value);
88 map& operator=(initializer_list<value_type> il);
91 iterator begin() noexcept;
92 const_iterator begin() const noexcept;
93 iterator end() noexcept;
94 const_iterator end() const noexcept;
96 reverse_iterator rbegin() noexcept;
97 const_reverse_iterator rbegin() const noexcept;
98 reverse_iterator rend() noexcept;
99 const_reverse_iterator rend() const noexcept;
101 const_iterator cbegin() const noexcept;
102 const_iterator cend() const noexcept;
103 const_reverse_iterator crbegin() const noexcept;
104 const_reverse_iterator crend() const noexcept;
107 bool empty() const noexcept;
108 size_type size() const noexcept;
109 size_type max_size() const noexcept;
112 mapped_type& operator[](const key_type& k);
113 mapped_type& operator[](key_type&& k);
115 mapped_type& at(const key_type& k);
116 const mapped_type& at(const key_type& k) const;
119 template <class... Args>
120 pair<iterator, bool> emplace(Args&&... args);
121 template <class... Args>
122 iterator emplace_hint(const_iterator position, Args&&... args);
123 pair<iterator, bool> insert(const value_type& v);
125 pair<iterator, bool> insert(P&& p);
126 iterator insert(const_iterator position, const value_type& v);
128 iterator insert(const_iterator position, P&& p);
129 template <class InputIterator>
130 void insert(InputIterator first, InputIterator last);
131 void insert(initializer_list<value_type> il);
133 iterator erase(const_iterator position);
134 size_type erase(const key_type& k);
135 iterator erase(const_iterator first, const_iterator last);
136 void clear() noexcept;
140 __is_nothrow_swappable<key_compare>::value &&
141 (!allocator_type::propagate_on_container_swap::value ||
142 __is_nothrow_swappable<allocator_type>::value));
145 allocator_type get_allocator() const noexcept;
146 key_compare key_comp() const;
147 value_compare value_comp() const;
150 iterator find(const key_type& k);
151 const_iterator find(const key_type& k) const;
152 size_type count(const key_type& k) const;
153 iterator lower_bound(const key_type& k);
154 const_iterator lower_bound(const key_type& k) const;
155 iterator upper_bound(const key_type& k);
156 const_iterator upper_bound(const key_type& k) const;
157 pair<iterator,iterator> equal_range(const key_type& k);
158 pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
161 template <class Key, class T, class Compare, class Allocator>
163 operator==(const map<Key, T, Compare, Allocator>& x,
164 const map<Key, T, Compare, Allocator>& y);
166 template <class Key, class T, class Compare, class Allocator>
168 operator< (const map<Key, T, Compare, Allocator>& x,
169 const map<Key, T, Compare, Allocator>& y);
171 template <class Key, class T, class Compare, class Allocator>
173 operator!=(const map<Key, T, Compare, Allocator>& x,
174 const map<Key, T, Compare, Allocator>& y);
176 template <class Key, class T, class Compare, class Allocator>
178 operator> (const map<Key, T, Compare, Allocator>& x,
179 const map<Key, T, Compare, Allocator>& y);
181 template <class Key, class T, class Compare, class Allocator>
183 operator>=(const map<Key, T, Compare, Allocator>& x,
184 const map<Key, T, Compare, Allocator>& y);
186 template <class Key, class T, class Compare, class Allocator>
188 operator<=(const map<Key, T, Compare, Allocator>& x,
189 const map<Key, T, Compare, Allocator>& y);
191 // specialized algorithms:
192 template <class Key, class T, class Compare, class Allocator>
194 swap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y)
195 noexcept(noexcept(x.swap(y)));
197 template <class Key, class T, class Compare = less<Key>,
198 class Allocator = allocator<pair<const Key, T>>>
203 typedef Key key_type;
204 typedef T mapped_type;
205 typedef pair<const key_type,mapped_type> value_type;
206 typedef Compare key_compare;
207 typedef Allocator allocator_type;
208 typedef typename allocator_type::reference reference;
209 typedef typename allocator_type::const_reference const_reference;
210 typedef typename allocator_type::size_type size_type;
211 typedef typename allocator_type::difference_type difference_type;
212 typedef typename allocator_type::pointer pointer;
213 typedef typename allocator_type::const_pointer const_pointer;
215 typedef implementation-defined iterator;
216 typedef implementation-defined const_iterator;
217 typedef std::reverse_iterator<iterator> reverse_iterator;
218 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
221 : public binary_function<value_type,value_type,bool>
223 friend class multimap;
226 value_compare(key_compare c);
228 bool operator()(const value_type& x, const value_type& y) const;
231 // construct/copy/destroy:
234 is_nothrow_default_constructible<allocator_type>::value &&
235 is_nothrow_default_constructible<key_compare>::value &&
236 is_nothrow_copy_constructible<key_compare>::value);
237 explicit multimap(const key_compare& comp);
238 multimap(const key_compare& comp, const allocator_type& a);
239 template <class InputIterator>
240 multimap(InputIterator first, InputIterator last, const key_compare& comp);
241 template <class InputIterator>
242 multimap(InputIterator first, InputIterator last, const key_compare& comp,
243 const allocator_type& a);
244 multimap(const multimap& m);
245 multimap(multimap&& m)
247 is_nothrow_move_constructible<allocator_type>::value &&
248 is_nothrow_move_constructible<key_compare>::value);
249 explicit multimap(const allocator_type& a);
250 multimap(const multimap& m, const allocator_type& a);
251 multimap(multimap&& m, const allocator_type& a);
252 multimap(initializer_list<value_type> il, const key_compare& comp = key_compare());
253 multimap(initializer_list<value_type> il, const key_compare& comp,
254 const allocator_type& a);
257 multimap& operator=(const multimap& m);
258 multimap& operator=(multimap&& m)
260 allocator_type::propagate_on_container_move_assignment::value &&
261 is_nothrow_move_assignable<allocator_type>::value &&
262 is_nothrow_move_assignable<key_compare>::value);
263 multimap& operator=(initializer_list<value_type> il);
266 iterator begin() noexcept;
267 const_iterator begin() const noexcept;
268 iterator end() noexcept;
269 const_iterator end() const noexcept;
271 reverse_iterator rbegin() noexcept;
272 const_reverse_iterator rbegin() const noexcept;
273 reverse_iterator rend() noexcept;
274 const_reverse_iterator rend() const noexcept;
276 const_iterator cbegin() const noexcept;
277 const_iterator cend() const noexcept;
278 const_reverse_iterator crbegin() const noexcept;
279 const_reverse_iterator crend() const noexcept;
282 bool empty() const noexcept;
283 size_type size() const noexcept;
284 size_type max_size() const noexcept;
287 template <class... Args>
288 iterator emplace(Args&&... args);
289 template <class... Args>
290 iterator emplace_hint(const_iterator position, Args&&... args);
291 iterator insert(const value_type& v);
293 iterator insert(P&& p);
294 iterator insert(const_iterator position, const value_type& v);
296 iterator insert(const_iterator position, P&& p);
297 template <class InputIterator>
298 void insert(InputIterator first, InputIterator last);
299 void insert(initializer_list<value_type> il);
301 iterator erase(const_iterator position);
302 size_type erase(const key_type& k);
303 iterator erase(const_iterator first, const_iterator last);
304 void clear() noexcept;
306 void swap(multimap& m)
308 __is_nothrow_swappable<key_compare>::value &&
309 (!allocator_type::propagate_on_container_swap::value ||
310 __is_nothrow_swappable<allocator_type>::value));
313 allocator_type get_allocator() const noexcept;
314 key_compare key_comp() const;
315 value_compare value_comp() const;
318 iterator find(const key_type& k);
319 const_iterator find(const key_type& k) const;
320 size_type count(const key_type& k) const;
321 iterator lower_bound(const key_type& k);
322 const_iterator lower_bound(const key_type& k) const;
323 iterator upper_bound(const key_type& k);
324 const_iterator upper_bound(const key_type& k) const;
325 pair<iterator,iterator> equal_range(const key_type& k);
326 pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
329 template <class Key, class T, class Compare, class Allocator>
331 operator==(const multimap<Key, T, Compare, Allocator>& x,
332 const multimap<Key, T, Compare, Allocator>& y);
334 template <class Key, class T, class Compare, class Allocator>
336 operator< (const multimap<Key, T, Compare, Allocator>& x,
337 const multimap<Key, T, Compare, Allocator>& y);
339 template <class Key, class T, class Compare, class Allocator>
341 operator!=(const multimap<Key, T, Compare, Allocator>& x,
342 const multimap<Key, T, Compare, Allocator>& y);
344 template <class Key, class T, class Compare, class Allocator>
346 operator> (const multimap<Key, T, Compare, Allocator>& x,
347 const multimap<Key, T, Compare, Allocator>& y);
349 template <class Key, class T, class Compare, class Allocator>
351 operator>=(const multimap<Key, T, Compare, Allocator>& x,
352 const multimap<Key, T, Compare, Allocator>& y);
354 template <class Key, class T, class Compare, class Allocator>
356 operator<=(const multimap<Key, T, Compare, Allocator>& x,
357 const multimap<Key, T, Compare, Allocator>& y);
359 // specialized algorithms:
360 template <class Key, class T, class Compare, class Allocator>
362 swap(multimap<Key, T, Compare, Allocator>& x,
363 multimap<Key, T, Compare, Allocator>& y)
364 noexcept(noexcept(x.swap(y)));
375 #include <functional>
376 #include <initializer_list>
378 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
379 #pragma GCC system_header
382 _LIBCPP_BEGIN_NAMESPACE_STD
384 template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::value>
385 class __map_value_compare
388 typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
389 typedef pair<const _Key, _Tp> _CP;
391 _LIBCPP_INLINE_VISIBILITY
392 __map_value_compare()
393 _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
395 _LIBCPP_INLINE_VISIBILITY
396 __map_value_compare(_Compare c)
397 _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
399 _LIBCPP_INLINE_VISIBILITY
400 const _Compare& key_comp() const _NOEXCEPT {return *this;}
401 _LIBCPP_INLINE_VISIBILITY
402 bool operator()(const _CP& __x, const _CP& __y) const
403 {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
404 _LIBCPP_INLINE_VISIBILITY
405 bool operator()(const _CP& __x, const _P& __y) const
406 {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
407 _LIBCPP_INLINE_VISIBILITY
408 bool operator()(const _CP& __x, const _Key& __y) const
409 {return static_cast<const _Compare&>(*this)(__x.first, __y);}
410 _LIBCPP_INLINE_VISIBILITY
411 bool operator()(const _P& __x, const _CP& __y) const
412 {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
413 _LIBCPP_INLINE_VISIBILITY
414 bool operator()(const _P& __x, const _P& __y) const
415 {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
416 _LIBCPP_INLINE_VISIBILITY
417 bool operator()(const _P& __x, const _Key& __y) const
418 {return static_cast<const _Compare&>(*this)(__x.first, __y);}
419 _LIBCPP_INLINE_VISIBILITY
420 bool operator()(const _Key& __x, const _CP& __y) const
421 {return static_cast<const _Compare&>(*this)(__x, __y.first);}
422 _LIBCPP_INLINE_VISIBILITY
423 bool operator()(const _Key& __x, const _P& __y) const
424 {return static_cast<const _Compare&>(*this)(__x, __y.first);}
425 _LIBCPP_INLINE_VISIBILITY
426 bool operator()(const _Key& __x, const _Key& __y) const
427 {return static_cast<const _Compare&>(*this)(__x, __y);}
430 template <class _Key, class _Tp, class _Compare>
431 class __map_value_compare<_Key, _Tp, _Compare, false>
435 typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
436 typedef pair<const _Key, _Tp> _CP;
439 _LIBCPP_INLINE_VISIBILITY
440 __map_value_compare()
441 _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
443 _LIBCPP_INLINE_VISIBILITY
444 __map_value_compare(_Compare c)
445 _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
447 _LIBCPP_INLINE_VISIBILITY
448 const _Compare& key_comp() const _NOEXCEPT {return comp;}
450 _LIBCPP_INLINE_VISIBILITY
451 bool operator()(const _CP& __x, const _CP& __y) const
452 {return comp(__x.first, __y.first);}
453 _LIBCPP_INLINE_VISIBILITY
454 bool operator()(const _CP& __x, const _P& __y) const
455 {return comp(__x.first, __y.first);}
456 _LIBCPP_INLINE_VISIBILITY
457 bool operator()(const _CP& __x, const _Key& __y) const
458 {return comp(__x.first, __y);}
459 _LIBCPP_INLINE_VISIBILITY
460 bool operator()(const _P& __x, const _CP& __y) const
461 {return comp(__x.first, __y.first);}
462 _LIBCPP_INLINE_VISIBILITY
463 bool operator()(const _P& __x, const _P& __y) const
464 {return comp(__x.first, __y.first);}
465 _LIBCPP_INLINE_VISIBILITY
466 bool operator()(const _P& __x, const _Key& __y) const
467 {return comp(__x.first, __y);}
468 _LIBCPP_INLINE_VISIBILITY
469 bool operator()(const _Key& __x, const _CP& __y) const
470 {return comp(__x, __y.first);}
471 _LIBCPP_INLINE_VISIBILITY
472 bool operator()(const _Key& __x, const _P& __y) const
473 {return comp(__x, __y.first);}
474 _LIBCPP_INLINE_VISIBILITY
475 bool operator()(const _Key& __x, const _Key& __y) const
476 {return comp(__x, __y);}
479 template <class _Allocator>
480 class __map_node_destructor
482 typedef _Allocator allocator_type;
483 typedef allocator_traits<allocator_type> __alloc_traits;
484 typedef typename __alloc_traits::value_type::value_type value_type;
486 typedef typename __alloc_traits::pointer pointer;
488 typedef typename value_type::first_type first_type;
489 typedef typename value_type::second_type second_type;
491 allocator_type& __na_;
493 __map_node_destructor& operator=(const __map_node_destructor&);
496 bool __first_constructed;
497 bool __second_constructed;
499 _LIBCPP_INLINE_VISIBILITY
500 explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT
502 __first_constructed(false),
503 __second_constructed(false)
506 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
507 _LIBCPP_INLINE_VISIBILITY
508 __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT
510 __first_constructed(__x.__value_constructed),
511 __second_constructed(__x.__value_constructed)
513 __x.__value_constructed = false;
515 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
517 _LIBCPP_INLINE_VISIBILITY
518 void operator()(pointer __p) _NOEXCEPT
520 if (__second_constructed)
521 __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
522 if (__first_constructed)
523 __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
525 __alloc_traits::deallocate(__na_, __p, 1);
529 template <class _Key, class _Tp, class _Compare, class _Allocator>
531 template <class _Key, class _Tp, class _Compare, class _Allocator>
533 template <class _TreeIterator> class __map_const_iterator;
535 template <class _TreeIterator>
536 class _LIBCPP_VISIBLE __map_iterator
540 typedef typename _TreeIterator::__pointer_traits __pointer_traits;
541 typedef const typename _TreeIterator::value_type::first_type __key_type;
542 typedef typename _TreeIterator::value_type::second_type __mapped_type;
544 typedef bidirectional_iterator_tag iterator_category;
545 typedef pair<__key_type, __mapped_type> value_type;
546 typedef typename _TreeIterator::difference_type difference_type;
547 typedef value_type& reference;
548 typedef typename __pointer_traits::template
549 #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
552 rebind<value_type>::other
556 _LIBCPP_INLINE_VISIBILITY
557 __map_iterator() _NOEXCEPT {}
559 _LIBCPP_INLINE_VISIBILITY
560 __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
562 _LIBCPP_INLINE_VISIBILITY
563 reference operator*() const {return *operator->();}
564 _LIBCPP_INLINE_VISIBILITY
565 pointer operator->() const {return (pointer)__i_.operator->();}
567 _LIBCPP_INLINE_VISIBILITY
568 __map_iterator& operator++() {++__i_; return *this;}
569 _LIBCPP_INLINE_VISIBILITY
570 __map_iterator operator++(int)
572 __map_iterator __t(*this);
577 _LIBCPP_INLINE_VISIBILITY
578 __map_iterator& operator--() {--__i_; return *this;}
579 _LIBCPP_INLINE_VISIBILITY
580 __map_iterator operator--(int)
582 __map_iterator __t(*this);
587 friend _LIBCPP_INLINE_VISIBILITY
588 bool operator==(const __map_iterator& __x, const __map_iterator& __y)
589 {return __x.__i_ == __y.__i_;}
591 _LIBCPP_INLINE_VISIBILITY
592 bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
593 {return __x.__i_ != __y.__i_;}
595 template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
596 template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
597 template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
600 template <class _TreeIterator>
601 class _LIBCPP_VISIBLE __map_const_iterator
605 typedef typename _TreeIterator::__pointer_traits __pointer_traits;
606 typedef const typename _TreeIterator::value_type::first_type __key_type;
607 typedef typename _TreeIterator::value_type::second_type __mapped_type;
609 typedef bidirectional_iterator_tag iterator_category;
610 typedef pair<__key_type, __mapped_type> value_type;
611 typedef typename _TreeIterator::difference_type difference_type;
612 typedef const value_type& reference;
613 typedef typename __pointer_traits::template
614 #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
615 rebind<const value_type>
617 rebind<const value_type>::other
621 _LIBCPP_INLINE_VISIBILITY
622 __map_const_iterator() _NOEXCEPT {}
624 _LIBCPP_INLINE_VISIBILITY
625 __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
626 _LIBCPP_INLINE_VISIBILITY
627 __map_const_iterator(
628 __map_iterator<typename _TreeIterator::__non_const_iterator> __i)
632 _LIBCPP_INLINE_VISIBILITY
633 reference operator*() const {return *operator->();}
634 _LIBCPP_INLINE_VISIBILITY
635 pointer operator->() const {return (pointer)__i_.operator->();}
637 _LIBCPP_INLINE_VISIBILITY
638 __map_const_iterator& operator++() {++__i_; return *this;}
639 _LIBCPP_INLINE_VISIBILITY
640 __map_const_iterator operator++(int)
642 __map_const_iterator __t(*this);
647 _LIBCPP_INLINE_VISIBILITY
648 __map_const_iterator& operator--() {--__i_; return *this;}
649 _LIBCPP_INLINE_VISIBILITY
650 __map_const_iterator operator--(int)
652 __map_const_iterator __t(*this);
657 friend _LIBCPP_INLINE_VISIBILITY
658 bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y)
659 {return __x.__i_ == __y.__i_;}
660 friend _LIBCPP_INLINE_VISIBILITY
661 bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
662 {return __x.__i_ != __y.__i_;}
664 template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
665 template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
666 template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
669 template <class _Key, class _Tp, class _Compare = less<_Key>,
670 class _Allocator = allocator<pair<const _Key, _Tp> > >
671 class _LIBCPP_VISIBLE map
675 typedef _Key key_type;
676 typedef _Tp mapped_type;
677 typedef pair<const key_type, mapped_type> value_type;
678 typedef _Compare key_compare;
679 typedef _Allocator allocator_type;
680 typedef value_type& reference;
681 typedef const value_type& const_reference;
683 class _LIBCPP_VISIBLE value_compare
684 : public binary_function<value_type, value_type, bool>
690 _LIBCPP_INLINE_VISIBILITY value_compare(key_compare c) : comp(c) {}
692 _LIBCPP_INLINE_VISIBILITY
693 bool operator()(const value_type& __x, const value_type& __y) const
694 {return comp(__x.first, __y.first);}
698 typedef pair<key_type, mapped_type> __value_type;
699 typedef __map_value_compare<key_type, mapped_type, key_compare> __vc;
700 typedef typename allocator_traits<allocator_type>::template
701 #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
702 rebind_alloc<__value_type>
704 rebind_alloc<__value_type>::other
707 typedef __tree<__value_type, __vc, __allocator_type> __base;
708 typedef typename __base::__node_traits __node_traits;
709 typedef allocator_traits<allocator_type> __alloc_traits;
714 typedef typename __alloc_traits::pointer pointer;
715 typedef typename __alloc_traits::const_pointer const_pointer;
716 typedef typename __alloc_traits::size_type size_type;
717 typedef typename __alloc_traits::difference_type difference_type;
718 typedef __map_iterator<typename __base::iterator> iterator;
719 typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
720 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
721 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
723 _LIBCPP_INLINE_VISIBILITY
724 explicit map(const key_compare& __comp = key_compare())
726 is_nothrow_default_constructible<allocator_type>::value &&
727 is_nothrow_default_constructible<key_compare>::value &&
728 is_nothrow_copy_constructible<key_compare>::value)
729 : __tree_(__vc(__comp)) {}
731 _LIBCPP_INLINE_VISIBILITY
732 explicit map(const key_compare& __comp, const allocator_type& __a)
733 : __tree_(__vc(__comp), __a) {}
735 template <class _InputIterator>
736 _LIBCPP_INLINE_VISIBILITY
737 map(_InputIterator __f, _InputIterator __l,
738 const key_compare& __comp = key_compare())
739 : __tree_(__vc(__comp))
744 template <class _InputIterator>
745 _LIBCPP_INLINE_VISIBILITY
746 map(_InputIterator __f, _InputIterator __l,
747 const key_compare& __comp, const allocator_type& __a)
748 : __tree_(__vc(__comp), __a)
753 _LIBCPP_INLINE_VISIBILITY
755 : __tree_(__m.__tree_)
757 insert(__m.begin(), __m.end());
760 _LIBCPP_INLINE_VISIBILITY
761 map& operator=(const map& __m)
763 __tree_ = __m.__tree_;
767 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
769 _LIBCPP_INLINE_VISIBILITY
771 _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
772 : __tree_(_VSTD::move(__m.__tree_))
776 map(map&& __m, const allocator_type& __a);
778 _LIBCPP_INLINE_VISIBILITY
779 map& operator=(map&& __m)
780 _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
782 __tree_ = _VSTD::move(__m.__tree_);
786 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
788 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
790 _LIBCPP_INLINE_VISIBILITY
791 map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
792 : __tree_(__vc(__comp))
794 insert(__il.begin(), __il.end());
797 _LIBCPP_INLINE_VISIBILITY
798 map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
799 : __tree_(__vc(__comp), __a)
801 insert(__il.begin(), __il.end());
804 _LIBCPP_INLINE_VISIBILITY
805 map& operator=(initializer_list<value_type> __il)
807 __tree_.__assign_unique(__il.begin(), __il.end());
811 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
813 _LIBCPP_INLINE_VISIBILITY
814 explicit map(const allocator_type& __a)
819 _LIBCPP_INLINE_VISIBILITY
820 map(const map& __m, const allocator_type& __a)
821 : __tree_(__m.__tree_.value_comp(), __a)
823 insert(__m.begin(), __m.end());
826 _LIBCPP_INLINE_VISIBILITY
827 iterator begin() _NOEXCEPT {return __tree_.begin();}
828 _LIBCPP_INLINE_VISIBILITY
829 const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
830 _LIBCPP_INLINE_VISIBILITY
831 iterator end() _NOEXCEPT {return __tree_.end();}
832 _LIBCPP_INLINE_VISIBILITY
833 const_iterator end() const _NOEXCEPT {return __tree_.end();}
835 _LIBCPP_INLINE_VISIBILITY
836 reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
837 _LIBCPP_INLINE_VISIBILITY
838 const_reverse_iterator rbegin() const _NOEXCEPT
839 {return const_reverse_iterator(end());}
840 _LIBCPP_INLINE_VISIBILITY
841 reverse_iterator rend() _NOEXCEPT
842 {return reverse_iterator(begin());}
843 _LIBCPP_INLINE_VISIBILITY
844 const_reverse_iterator rend() const _NOEXCEPT
845 {return const_reverse_iterator(begin());}
847 _LIBCPP_INLINE_VISIBILITY
848 const_iterator cbegin() const _NOEXCEPT {return begin();}
849 _LIBCPP_INLINE_VISIBILITY
850 const_iterator cend() const _NOEXCEPT {return end();}
851 _LIBCPP_INLINE_VISIBILITY
852 const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
853 _LIBCPP_INLINE_VISIBILITY
854 const_reverse_iterator crend() const _NOEXCEPT {return rend();}
856 _LIBCPP_INLINE_VISIBILITY
857 bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
858 _LIBCPP_INLINE_VISIBILITY
859 size_type size() const _NOEXCEPT {return __tree_.size();}
860 _LIBCPP_INLINE_VISIBILITY
861 size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
863 mapped_type& operator[](const key_type& __k);
864 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
865 mapped_type& operator[](key_type&& __k);
868 mapped_type& at(const key_type& __k);
869 const mapped_type& at(const key_type& __k) const;
871 _LIBCPP_INLINE_VISIBILITY
872 allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
873 _LIBCPP_INLINE_VISIBILITY
874 key_compare key_comp() const {return __tree_.value_comp().key_comp();}
875 _LIBCPP_INLINE_VISIBILITY
876 value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
878 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
880 _LIBCPP_INLINE_VISIBILITY
882 emplace() {return __tree_.__emplace_unique();}
885 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
886 _LIBCPP_INLINE_VISIBILITY
889 {return __tree_.__emplace_unique(_VSTD::forward<_A0>(__a0));}
891 #ifndef _LIBCPP_HAS_NO_VARIADICS
893 template <class _A0, class ..._Args,
894 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
896 emplace(_A0&& __a0, _Args&& ...__args);
898 #endif // _LIBCPP_HAS_NO_VARIADICS
900 _LIBCPP_INLINE_VISIBILITY
902 emplace_hint(const_iterator __p)
903 {return __tree_.__emplace_hint_unique(__p.__i_);}
906 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
907 _LIBCPP_INLINE_VISIBILITY
909 emplace_hint(const_iterator __p, _A0&& __a0)
910 {return __tree_.__emplace_hint_unique(__p.__i_, _VSTD::forward<_A0>(__a0));}
912 #ifndef _LIBCPP_HAS_NO_VARIADICS
914 template <class _A0, class ..._Args,
915 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
917 emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
919 #endif // _LIBCPP_HAS_NO_VARIADICS
922 class = typename enable_if<is_constructible<value_type, _P>::value>::type>
923 _LIBCPP_INLINE_VISIBILITY
924 pair<iterator, bool> insert(_P&& __p)
925 {return __tree_.__insert_unique(_VSTD::forward<_P>(__p));}
928 class = typename enable_if<is_constructible<value_type, _P>::value>::type>
929 _LIBCPP_INLINE_VISIBILITY
930 iterator insert(const_iterator __pos, _P&& __p)
931 {return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_P>(__p));}
933 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
935 _LIBCPP_INLINE_VISIBILITY
937 insert(const value_type& __v) {return __tree_.__insert_unique(__v);}
939 _LIBCPP_INLINE_VISIBILITY
941 insert(const_iterator __p, const value_type& __v)
942 {return __tree_.__insert_unique(__p.__i_, __v);}
944 template <class _InputIterator>
945 _LIBCPP_INLINE_VISIBILITY
946 void insert(_InputIterator __f, _InputIterator __l)
948 for (const_iterator __e = cend(); __f != __l; ++__f)
949 insert(__e.__i_, *__f);
952 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
954 _LIBCPP_INLINE_VISIBILITY
955 void insert(initializer_list<value_type> __il)
956 {insert(__il.begin(), __il.end());}
958 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
960 _LIBCPP_INLINE_VISIBILITY
961 iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
962 _LIBCPP_INLINE_VISIBILITY
963 size_type erase(const key_type& __k)
964 {return __tree_.__erase_unique(__k);}
965 _LIBCPP_INLINE_VISIBILITY
966 iterator erase(const_iterator __f, const_iterator __l)
967 {return __tree_.erase(__f.__i_, __l.__i_);}
968 _LIBCPP_INLINE_VISIBILITY
969 void clear() _NOEXCEPT {__tree_.clear();}
971 _LIBCPP_INLINE_VISIBILITY
973 _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
974 {__tree_.swap(__m.__tree_);}
976 _LIBCPP_INLINE_VISIBILITY
977 iterator find(const key_type& __k) {return __tree_.find(__k);}
978 _LIBCPP_INLINE_VISIBILITY
979 const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
980 _LIBCPP_INLINE_VISIBILITY
981 size_type count(const key_type& __k) const
982 {return __tree_.__count_unique(__k);}
983 _LIBCPP_INLINE_VISIBILITY
984 iterator lower_bound(const key_type& __k)
985 {return __tree_.lower_bound(__k);}
986 _LIBCPP_INLINE_VISIBILITY
987 const_iterator lower_bound(const key_type& __k) const
988 {return __tree_.lower_bound(__k);}
989 _LIBCPP_INLINE_VISIBILITY
990 iterator upper_bound(const key_type& __k)
991 {return __tree_.upper_bound(__k);}
992 _LIBCPP_INLINE_VISIBILITY
993 const_iterator upper_bound(const key_type& __k) const
994 {return __tree_.upper_bound(__k);}
995 _LIBCPP_INLINE_VISIBILITY
996 pair<iterator,iterator> equal_range(const key_type& __k)
997 {return __tree_.__equal_range_unique(__k);}
998 _LIBCPP_INLINE_VISIBILITY
999 pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
1000 {return __tree_.__equal_range_unique(__k);}
1003 typedef typename __base::__node __node;
1004 typedef typename __base::__node_allocator __node_allocator;
1005 typedef typename __base::__node_pointer __node_pointer;
1006 typedef typename __base::__node_const_pointer __node_const_pointer;
1007 typedef typename __base::__node_base_pointer __node_base_pointer;
1008 typedef typename __base::__node_base_const_pointer __node_base_const_pointer;
1009 typedef __map_node_destructor<__node_allocator> _D;
1010 typedef unique_ptr<__node, _D> __node_holder;
1012 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1013 __node_holder __construct_node();
1014 template <class _A0,
1015 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
1016 __node_holder __construct_node(_A0&& __a0);
1017 #ifndef _LIBCPP_HAS_NO_VARIADICS
1018 template <class _A0, class ..._Args,
1019 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
1020 __node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
1021 #endif // _LIBCPP_HAS_NO_VARIADICS
1022 #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1023 __node_holder __construct_node(const key_type& __k);
1026 __node_base_pointer&
1027 __find_equal_key(__node_base_pointer& __parent, const key_type& __k);
1028 __node_base_pointer&
1029 __find_equal_key(const_iterator __hint,
1030 __node_base_pointer& __parent, const key_type& __k);
1031 __node_base_const_pointer
1032 __find_equal_key(__node_base_const_pointer& __parent, const key_type& __k) const;
1035 // Find place to insert if __k doesn't exist
1036 // Set __parent to parent of null leaf
1037 // Return reference to null leaf
1038 // If __k exists, set parent to node of __k and return reference to node of __k
1039 template <class _Key, class _Tp, class _Compare, class _Allocator>
1040 typename map<_Key, _Tp, _Compare, _Allocator>::__node_base_pointer&
1041 map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(__node_base_pointer& __parent,
1042 const key_type& __k)
1044 __node_pointer __nd = __tree_.__root();
1045 if (__nd != nullptr)
1049 if (__tree_.value_comp().key_comp()(__k, __nd->__value_.first))
1051 if (__nd->__left_ != nullptr)
1052 __nd = static_cast<__node_pointer>(__nd->__left_);
1056 return __parent->__left_;
1059 else if (__tree_.value_comp().key_comp()(__nd->__value_.first, __k))
1061 if (__nd->__right_ != nullptr)
1062 __nd = static_cast<__node_pointer>(__nd->__right_);
1066 return __parent->__right_;
1076 __parent = __tree_.__end_node();
1077 return __parent->__left_;
1080 // Find place to insert if __k doesn't exist
1081 // First check prior to __hint.
1082 // Next check after __hint.
1083 // Next do O(log N) search.
1084 // Set __parent to parent of null leaf
1085 // Return reference to null leaf
1086 // If __k exists, set parent to node of __k and return reference to node of __k
1087 template <class _Key, class _Tp, class _Compare, class _Allocator>
1088 typename map<_Key, _Tp, _Compare, _Allocator>::__node_base_pointer&
1089 map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(const_iterator __hint,
1090 __node_base_pointer& __parent,
1091 const key_type& __k)
1093 if (__hint == end() || __tree_.value_comp().key_comp()(__k, __hint->first)) // check before
1096 const_iterator __prior = __hint;
1097 if (__prior == begin() || __tree_.value_comp().key_comp()((--__prior)->first, __k))
1099 // *prev(__hint) < __k < *__hint
1100 if (__hint.__ptr_->__left_ == nullptr)
1102 __parent = const_cast<__node_pointer&>(__hint.__ptr_);
1103 return __parent->__left_;
1107 __parent = const_cast<__node_pointer&>(__prior.__ptr_);
1108 return __parent->__right_;
1111 // __k <= *prev(__hint)
1112 return __find_equal_key(__parent, __k);
1114 else if (__tree_.value_comp().key_comp()(__hint->first, __k)) // check after
1117 const_iterator __next = _VSTD::next(__hint);
1118 if (__next == end() || __tree_.value_comp().key_comp()(__k, __next->first))
1120 // *__hint < __k < *next(__hint)
1121 if (__hint.__ptr_->__right_ == nullptr)
1123 __parent = const_cast<__node_pointer&>(__hint.__ptr_);
1124 return __parent->__right_;
1128 __parent = const_cast<__node_pointer&>(__next.__ptr_);
1129 return __parent->__left_;
1132 // *next(__hint) <= __k
1133 return __find_equal_key(__parent, __k);
1135 // else __k == *__hint
1136 __parent = const_cast<__node_pointer&>(__hint.__ptr_);
1141 // Set __parent to parent of null leaf and
1142 // return reference to null leaf iv __k does not exist.
1143 // If __k exists, set parent to node of __k and return reference to node of __k
1144 template <class _Key, class _Tp, class _Compare, class _Allocator>
1145 typename map<_Key, _Tp, _Compare, _Allocator>::__node_base_const_pointer
1146 map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(__node_base_const_pointer& __parent,
1147 const key_type& __k) const
1149 __node_const_pointer __nd = __tree_.__root();
1150 if (__nd != nullptr)
1154 if (__tree_.value_comp().key_comp()(__k, __nd->__value_.first))
1156 if (__nd->__left_ != nullptr)
1157 __nd = static_cast<__node_pointer>(__nd->__left_);
1161 return const_cast<const __node_base_const_pointer&>(__parent->__left_);
1164 else if (__tree_.value_comp().key_comp()(__nd->__value_.first, __k))
1166 if (__nd->__right_ != nullptr)
1167 __nd = static_cast<__node_pointer>(__nd->__right_);
1171 return const_cast<const __node_base_const_pointer&>(__parent->__right_);
1181 __parent = __tree_.__end_node();
1182 return const_cast<const __node_base_const_pointer&>(__parent->__left_);
1185 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1187 template <class _Key, class _Tp, class _Compare, class _Allocator>
1188 map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
1189 : __tree_(_VSTD::move(__m.__tree_), __a)
1191 if (__a != __m.get_allocator())
1193 const_iterator __e = cend();
1194 while (!__m.empty())
1195 __tree_.__insert_unique(__e.__i_,
1196 _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
1200 template <class _Key, class _Tp, class _Compare, class _Allocator>
1201 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
1202 map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
1204 __node_allocator& __na = __tree_.__node_alloc();
1205 __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
1206 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
1207 __h.get_deleter().__first_constructed = true;
1208 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
1209 __h.get_deleter().__second_constructed = true;
1213 template <class _Key, class _Tp, class _Compare, class _Allocator>
1214 template <class _A0,
1216 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
1217 map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
1219 __node_allocator& __na = __tree_.__node_alloc();
1220 __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
1221 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
1222 __h.get_deleter().__first_constructed = true;
1223 __h.get_deleter().__second_constructed = true;
1227 #ifndef _LIBCPP_HAS_NO_VARIADICS
1229 template <class _Key, class _Tp, class _Compare, class _Allocator>
1230 template <class _A0, class ..._Args,
1232 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
1233 map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
1235 __node_allocator& __na = __tree_.__node_alloc();
1236 __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
1237 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
1238 __h.get_deleter().__first_constructed = true;
1239 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
1240 __h.get_deleter().__second_constructed = true;
1244 #endif // _LIBCPP_HAS_NO_VARIADICS
1246 #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1248 template <class _Key, class _Tp, class _Compare, class _Allocator>
1249 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
1250 map<_Key, _Tp, _Compare, _Allocator>::__construct_node(const key_type& __k)
1252 __node_allocator& __na = __tree_.__node_alloc();
1253 __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
1254 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
1255 __h.get_deleter().__first_constructed = true;
1256 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
1257 __h.get_deleter().__second_constructed = true;
1258 return _VSTD::move(__h);
1261 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1263 template <class _Key, class _Tp, class _Compare, class _Allocator>
1265 map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
1267 __node_base_pointer __parent;
1268 __node_base_pointer& __child = __find_equal_key(__parent, __k);
1269 __node_pointer __r = static_cast<__node_pointer>(__child);
1270 if (__child == nullptr)
1272 __node_holder __h = __construct_node(__k);
1273 __tree_.__insert_node_at(__parent, __child, __h.get());
1274 __r = __h.release();
1276 return __r->__value_.second;
1279 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1281 template <class _Key, class _Tp, class _Compare, class _Allocator>
1283 map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
1285 __node_base_pointer __parent;
1286 __node_base_pointer& __child = __find_equal_key(__parent, __k);
1287 __node_pointer __r = static_cast<__node_pointer>(__child);
1288 if (__child == nullptr)
1290 __node_holder __h = __construct_node(_VSTD::move(__k));
1291 __tree_.__insert_node_at(__parent, __child, __h.get());
1292 __r = __h.release();
1294 return __r->__value_.second;
1297 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1299 template <class _Key, class _Tp, class _Compare, class _Allocator>
1301 map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)
1303 __node_base_pointer __parent;
1304 __node_base_pointer& __child = __find_equal_key(__parent, __k);
1305 #ifndef _LIBCPP_NO_EXCEPTIONS
1306 if (__child == nullptr)
1307 throw out_of_range("map::at: key not found");
1308 #endif // _LIBCPP_NO_EXCEPTIONS
1309 return static_cast<__node_pointer>(__child)->__value_.second;
1312 template <class _Key, class _Tp, class _Compare, class _Allocator>
1314 map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
1316 __node_base_const_pointer __parent;
1317 __node_base_const_pointer __child = __find_equal_key(__parent, __k);
1318 #ifndef _LIBCPP_NO_EXCEPTIONS
1319 if (__child == nullptr)
1320 throw out_of_range("map::at: key not found");
1321 #endif // _LIBCPP_NO_EXCEPTIONS
1322 return static_cast<__node_const_pointer>(__child)->__value_.second;
1325 #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
1327 template <class _Key, class _Tp, class _Compare, class _Allocator>
1328 template <class _A0, class ..._Args,
1329 class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
1331 pair<typename map<_Key, _Tp, _Compare, _Allocator>::iterator, bool>
1332 map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
1334 __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
1335 _VSTD::forward<_Args>(__args)...);
1336 pair<iterator, bool> __r = __tree_.__node_insert_unique(__h.get());
1342 template <class _Key, class _Tp, class _Compare, class _Allocator>
1343 template <class _A0, class ..._Args,
1344 class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
1346 typename map<_Key, _Tp, _Compare, _Allocator>::iterator
1347 map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
1348 _A0&& __a0, _Args&& ...__args)
1350 __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
1351 _VSTD::forward<_Args>(__args)...);
1352 iterator __r = __tree_.__node_insert_unique(__p.__i_, __h.get());
1353 if (__r.__i_.__ptr_ == __h.get())
1358 #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
1360 template <class _Key, class _Tp, class _Compare, class _Allocator>
1361 inline _LIBCPP_INLINE_VISIBILITY
1363 operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1364 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1366 return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
1369 template <class _Key, class _Tp, class _Compare, class _Allocator>
1370 inline _LIBCPP_INLINE_VISIBILITY
1372 operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
1373 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1375 return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
1378 template <class _Key, class _Tp, class _Compare, class _Allocator>
1379 inline _LIBCPP_INLINE_VISIBILITY
1381 operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1382 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1384 return !(__x == __y);
1387 template <class _Key, class _Tp, class _Compare, class _Allocator>
1388 inline _LIBCPP_INLINE_VISIBILITY
1390 operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x,
1391 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1396 template <class _Key, class _Tp, class _Compare, class _Allocator>
1397 inline _LIBCPP_INLINE_VISIBILITY
1399 operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1400 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1402 return !(__x < __y);
1405 template <class _Key, class _Tp, class _Compare, class _Allocator>
1406 inline _LIBCPP_INLINE_VISIBILITY
1408 operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1409 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1411 return !(__y < __x);
1414 template <class _Key, class _Tp, class _Compare, class _Allocator>
1415 inline _LIBCPP_INLINE_VISIBILITY
1417 swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
1418 map<_Key, _Tp, _Compare, _Allocator>& __y)
1419 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
1424 template <class _Key, class _Tp, class _Compare = less<_Key>,
1425 class _Allocator = allocator<pair<const _Key, _Tp> > >
1426 class _LIBCPP_VISIBLE multimap
1430 typedef _Key key_type;
1431 typedef _Tp mapped_type;
1432 typedef pair<const key_type, mapped_type> value_type;
1433 typedef _Compare key_compare;
1434 typedef _Allocator allocator_type;
1435 typedef value_type& reference;
1436 typedef const value_type& const_reference;
1438 class _LIBCPP_VISIBLE value_compare
1439 : public binary_function<value_type, value_type, bool>
1441 friend class multimap;
1445 _LIBCPP_INLINE_VISIBILITY
1446 value_compare(key_compare c) : comp(c) {}
1448 _LIBCPP_INLINE_VISIBILITY
1449 bool operator()(const value_type& __x, const value_type& __y) const
1450 {return comp(__x.first, __y.first);}
1454 typedef pair<key_type, mapped_type> __value_type;
1455 typedef __map_value_compare<key_type, mapped_type, key_compare> __vc;
1456 typedef typename allocator_traits<allocator_type>::template
1457 #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
1458 rebind_alloc<__value_type>
1460 rebind_alloc<__value_type>::other
1463 typedef __tree<__value_type, __vc, __allocator_type> __base;
1464 typedef typename __base::__node_traits __node_traits;
1465 typedef allocator_traits<allocator_type> __alloc_traits;
1470 typedef typename __alloc_traits::pointer pointer;
1471 typedef typename __alloc_traits::const_pointer const_pointer;
1472 typedef typename __alloc_traits::size_type size_type;
1473 typedef typename __alloc_traits::difference_type difference_type;
1474 typedef __map_iterator<typename __base::iterator> iterator;
1475 typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
1476 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
1477 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
1479 _LIBCPP_INLINE_VISIBILITY
1480 explicit multimap(const key_compare& __comp = key_compare())
1482 is_nothrow_default_constructible<allocator_type>::value &&
1483 is_nothrow_default_constructible<key_compare>::value &&
1484 is_nothrow_copy_constructible<key_compare>::value)
1485 : __tree_(__vc(__comp)) {}
1487 _LIBCPP_INLINE_VISIBILITY
1488 explicit multimap(const key_compare& __comp, const allocator_type& __a)
1489 : __tree_(__vc(__comp), __a) {}
1491 template <class _InputIterator>
1492 _LIBCPP_INLINE_VISIBILITY
1493 multimap(_InputIterator __f, _InputIterator __l,
1494 const key_compare& __comp = key_compare())
1495 : __tree_(__vc(__comp))
1500 template <class _InputIterator>
1501 _LIBCPP_INLINE_VISIBILITY
1502 multimap(_InputIterator __f, _InputIterator __l,
1503 const key_compare& __comp, const allocator_type& __a)
1504 : __tree_(__vc(__comp), __a)
1509 _LIBCPP_INLINE_VISIBILITY
1510 multimap(const multimap& __m)
1511 : __tree_(__m.__tree_.value_comp(),
1512 __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc()))
1514 insert(__m.begin(), __m.end());
1517 _LIBCPP_INLINE_VISIBILITY
1518 multimap& operator=(const multimap& __m)
1520 __tree_ = __m.__tree_;
1524 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1526 _LIBCPP_INLINE_VISIBILITY
1527 multimap(multimap&& __m)
1528 _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
1529 : __tree_(_VSTD::move(__m.__tree_))
1533 multimap(multimap&& __m, const allocator_type& __a);
1535 _LIBCPP_INLINE_VISIBILITY
1536 multimap& operator=(multimap&& __m)
1537 _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
1539 __tree_ = _VSTD::move(__m.__tree_);
1543 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1545 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1547 _LIBCPP_INLINE_VISIBILITY
1548 multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
1549 : __tree_(__vc(__comp))
1551 insert(__il.begin(), __il.end());
1554 _LIBCPP_INLINE_VISIBILITY
1555 multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
1556 : __tree_(__vc(__comp), __a)
1558 insert(__il.begin(), __il.end());
1561 _LIBCPP_INLINE_VISIBILITY
1562 multimap& operator=(initializer_list<value_type> __il)
1564 __tree_.__assign_multi(__il.begin(), __il.end());
1568 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1570 _LIBCPP_INLINE_VISIBILITY
1571 explicit multimap(const allocator_type& __a)
1576 _LIBCPP_INLINE_VISIBILITY
1577 multimap(const multimap& __m, const allocator_type& __a)
1578 : __tree_(__m.__tree_.value_comp(), __a)
1580 insert(__m.begin(), __m.end());
1583 _LIBCPP_INLINE_VISIBILITY
1584 iterator begin() _NOEXCEPT {return __tree_.begin();}
1585 _LIBCPP_INLINE_VISIBILITY
1586 const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
1587 _LIBCPP_INLINE_VISIBILITY
1588 iterator end() _NOEXCEPT {return __tree_.end();}
1589 _LIBCPP_INLINE_VISIBILITY
1590 const_iterator end() const _NOEXCEPT {return __tree_.end();}
1592 _LIBCPP_INLINE_VISIBILITY
1593 reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
1594 _LIBCPP_INLINE_VISIBILITY
1595 const_reverse_iterator rbegin() const _NOEXCEPT
1596 {return const_reverse_iterator(end());}
1597 _LIBCPP_INLINE_VISIBILITY
1598 reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
1599 _LIBCPP_INLINE_VISIBILITY
1600 const_reverse_iterator rend() const _NOEXCEPT
1601 {return const_reverse_iterator(begin());}
1603 _LIBCPP_INLINE_VISIBILITY
1604 const_iterator cbegin() const _NOEXCEPT {return begin();}
1605 _LIBCPP_INLINE_VISIBILITY
1606 const_iterator cend() const _NOEXCEPT {return end();}
1607 _LIBCPP_INLINE_VISIBILITY
1608 const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
1609 _LIBCPP_INLINE_VISIBILITY
1610 const_reverse_iterator crend() const _NOEXCEPT {return rend();}
1612 _LIBCPP_INLINE_VISIBILITY
1613 bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
1614 _LIBCPP_INLINE_VISIBILITY
1615 size_type size() const _NOEXCEPT {return __tree_.size();}
1616 _LIBCPP_INLINE_VISIBILITY
1617 size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
1619 _LIBCPP_INLINE_VISIBILITY
1620 allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
1621 _LIBCPP_INLINE_VISIBILITY
1622 key_compare key_comp() const {return __tree_.value_comp().key_comp();}
1623 _LIBCPP_INLINE_VISIBILITY
1624 value_compare value_comp() const
1625 {return value_compare(__tree_.value_comp().key_comp());}
1627 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1629 _LIBCPP_INLINE_VISIBILITY
1630 iterator emplace() {return __tree_.__emplace_multi();}
1632 template <class _A0,
1633 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
1634 _LIBCPP_INLINE_VISIBILITY
1637 {return __tree_.__emplace_multi(_VSTD::forward<_A0>(__a0));}
1639 #ifndef _LIBCPP_HAS_NO_VARIADICS
1641 template <class _A0, class ..._Args,
1642 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
1644 emplace(_A0&& __a0, _Args&& ...__args);
1646 #endif // _LIBCPP_HAS_NO_VARIADICS
1648 _LIBCPP_INLINE_VISIBILITY
1649 iterator emplace_hint(const_iterator __p)
1650 {return __tree_.__emplace_hint_multi(__p.__i_);}
1652 template <class _A0,
1653 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
1654 _LIBCPP_INLINE_VISIBILITY
1656 emplace_hint(const_iterator __p, _A0&& __a0)
1657 {return __tree_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_A0>(__a0));}
1659 #ifndef _LIBCPP_HAS_NO_VARIADICS
1661 template <class _A0, class ..._Args,
1662 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
1664 emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
1666 #endif // _LIBCPP_HAS_NO_VARIADICS
1669 class = typename enable_if<is_constructible<value_type, _P>::value>::type>
1670 _LIBCPP_INLINE_VISIBILITY
1671 iterator insert(_P&& __p)
1672 {return __tree_.__insert_multi(_VSTD::forward<_P>(__p));}
1675 class = typename enable_if<is_constructible<value_type, _P>::value>::type>
1676 _LIBCPP_INLINE_VISIBILITY
1677 iterator insert(const_iterator __pos, _P&& __p)
1678 {return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_P>(__p));}
1680 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1682 _LIBCPP_INLINE_VISIBILITY
1683 iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);}
1685 _LIBCPP_INLINE_VISIBILITY
1686 iterator insert(const_iterator __p, const value_type& __v)
1687 {return __tree_.__insert_multi(__p.__i_, __v);}
1689 template <class _InputIterator>
1690 _LIBCPP_INLINE_VISIBILITY
1691 void insert(_InputIterator __f, _InputIterator __l)
1693 for (const_iterator __e = cend(); __f != __l; ++__f)
1694 __tree_.__insert_multi(__e.__i_, *__f);
1697 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1699 _LIBCPP_INLINE_VISIBILITY
1700 void insert(initializer_list<value_type> __il)
1701 {insert(__il.begin(), __il.end());}
1703 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1705 _LIBCPP_INLINE_VISIBILITY
1706 iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
1707 _LIBCPP_INLINE_VISIBILITY
1708 size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
1709 _LIBCPP_INLINE_VISIBILITY
1710 iterator erase(const_iterator __f, const_iterator __l)
1711 {return __tree_.erase(__f.__i_, __l.__i_);}
1712 _LIBCPP_INLINE_VISIBILITY
1713 void clear() {__tree_.clear();}
1715 _LIBCPP_INLINE_VISIBILITY
1716 void swap(multimap& __m)
1717 _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
1718 {__tree_.swap(__m.__tree_);}
1720 _LIBCPP_INLINE_VISIBILITY
1721 iterator find(const key_type& __k) {return __tree_.find(__k);}
1722 _LIBCPP_INLINE_VISIBILITY
1723 const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
1724 _LIBCPP_INLINE_VISIBILITY
1725 size_type count(const key_type& __k) const
1726 {return __tree_.__count_multi(__k);}
1727 _LIBCPP_INLINE_VISIBILITY
1728 iterator lower_bound(const key_type& __k)
1729 {return __tree_.lower_bound(__k);}
1730 _LIBCPP_INLINE_VISIBILITY
1731 const_iterator lower_bound(const key_type& __k) const
1732 {return __tree_.lower_bound(__k);}
1733 _LIBCPP_INLINE_VISIBILITY
1734 iterator upper_bound(const key_type& __k)
1735 {return __tree_.upper_bound(__k);}
1736 _LIBCPP_INLINE_VISIBILITY
1737 const_iterator upper_bound(const key_type& __k) const
1738 {return __tree_.upper_bound(__k);}
1739 _LIBCPP_INLINE_VISIBILITY
1740 pair<iterator,iterator> equal_range(const key_type& __k)
1741 {return __tree_.__equal_range_multi(__k);}
1742 _LIBCPP_INLINE_VISIBILITY
1743 pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
1744 {return __tree_.__equal_range_multi(__k);}
1747 typedef typename __base::__node __node;
1748 typedef typename __base::__node_allocator __node_allocator;
1749 typedef typename __base::__node_pointer __node_pointer;
1750 typedef typename __base::__node_const_pointer __node_const_pointer;
1751 typedef __map_node_destructor<__node_allocator> _D;
1752 typedef unique_ptr<__node, _D> __node_holder;
1754 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1755 __node_holder __construct_node();
1756 template <class _A0,
1757 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
1758 __node_holder __construct_node(_A0&& __a0);
1759 #ifndef _LIBCPP_HAS_NO_VARIADICS
1760 template <class _A0, class ..._Args,
1761 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
1762 __node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
1763 #endif // _LIBCPP_HAS_NO_VARIADICS
1764 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1767 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1769 template <class _Key, class _Tp, class _Compare, class _Allocator>
1770 multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
1771 : __tree_(_VSTD::move(__m.__tree_), __a)
1773 if (__a != __m.get_allocator())
1775 const_iterator __e = cend();
1776 while (!__m.empty())
1777 __tree_.__insert_multi(__e.__i_,
1778 _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
1782 template <class _Key, class _Tp, class _Compare, class _Allocator>
1783 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
1784 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
1786 __node_allocator& __na = __tree_.__node_alloc();
1787 __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
1788 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
1789 __h.get_deleter().__first_constructed = true;
1790 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
1791 __h.get_deleter().__second_constructed = true;
1795 template <class _Key, class _Tp, class _Compare, class _Allocator>
1796 template <class _A0,
1797 class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
1799 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
1800 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
1802 __node_allocator& __na = __tree_.__node_alloc();
1803 __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
1804 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
1805 __h.get_deleter().__first_constructed = true;
1806 __h.get_deleter().__second_constructed = true;
1810 #ifndef _LIBCPP_HAS_NO_VARIADICS
1812 template <class _Key, class _Tp, class _Compare, class _Allocator>
1813 template <class _A0, class ..._Args,
1814 class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
1816 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
1817 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
1819 __node_allocator& __na = __tree_.__node_alloc();
1820 __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
1821 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
1822 __h.get_deleter().__first_constructed = true;
1823 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
1824 __h.get_deleter().__second_constructed = true;
1828 #endif // _LIBCPP_HAS_NO_VARIADICS
1829 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1831 #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
1833 template <class _Key, class _Tp, class _Compare, class _Allocator>
1834 template <class _A0, class ..._Args,
1835 class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
1837 typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
1838 multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
1840 __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
1841 _VSTD::forward<_Args>(__args)...);
1842 iterator __r = __tree_.__node_insert_multi(__h.get());
1847 template <class _Key, class _Tp, class _Compare, class _Allocator>
1848 template <class _A0, class ..._Args,
1849 class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
1851 typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
1852 multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
1856 __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
1857 _VSTD::forward<_Args>(__args)...);
1858 iterator __r = __tree_.__node_insert_multi(__p.__i_, __h.get());
1863 #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
1865 template <class _Key, class _Tp, class _Compare, class _Allocator>
1866 inline _LIBCPP_INLINE_VISIBILITY
1868 operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1869 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1871 return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
1874 template <class _Key, class _Tp, class _Compare, class _Allocator>
1875 inline _LIBCPP_INLINE_VISIBILITY
1877 operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1878 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1880 return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
1883 template <class _Key, class _Tp, class _Compare, class _Allocator>
1884 inline _LIBCPP_INLINE_VISIBILITY
1886 operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1887 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1889 return !(__x == __y);
1892 template <class _Key, class _Tp, class _Compare, class _Allocator>
1893 inline _LIBCPP_INLINE_VISIBILITY
1895 operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1896 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1901 template <class _Key, class _Tp, class _Compare, class _Allocator>
1902 inline _LIBCPP_INLINE_VISIBILITY
1904 operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1905 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1907 return !(__x < __y);
1910 template <class _Key, class _Tp, class _Compare, class _Allocator>
1911 inline _LIBCPP_INLINE_VISIBILITY
1913 operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1914 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1916 return !(__y < __x);
1919 template <class _Key, class _Tp, class _Compare, class _Allocator>
1920 inline _LIBCPP_INLINE_VISIBILITY
1922 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1923 multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1924 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
1929 _LIBCPP_END_NAMESPACE_STD
1931 #endif // _LIBCPP_MAP