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 #if __has_feature(is_final)
386 && !__is_final(_Compare)
389 class __map_value_compare
392 typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
393 typedef pair<const _Key, _Tp> _CP;
395 _LIBCPP_INLINE_VISIBILITY
396 __map_value_compare()
397 _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
399 _LIBCPP_INLINE_VISIBILITY
400 __map_value_compare(_Compare c)
401 _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
403 _LIBCPP_INLINE_VISIBILITY
404 const _Compare& key_comp() const _NOEXCEPT {return *this;}
405 _LIBCPP_INLINE_VISIBILITY
406 bool operator()(const _CP& __x, const _CP& __y) const
407 {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
408 _LIBCPP_INLINE_VISIBILITY
409 bool operator()(const _CP& __x, const _Pp& __y) const
410 {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
411 _LIBCPP_INLINE_VISIBILITY
412 bool operator()(const _CP& __x, const _Key& __y) const
413 {return static_cast<const _Compare&>(*this)(__x.first, __y);}
414 _LIBCPP_INLINE_VISIBILITY
415 bool operator()(const _Pp& __x, const _CP& __y) const
416 {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
417 _LIBCPP_INLINE_VISIBILITY
418 bool operator()(const _Pp& __x, const _Pp& __y) const
419 {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
420 _LIBCPP_INLINE_VISIBILITY
421 bool operator()(const _Pp& __x, const _Key& __y) const
422 {return static_cast<const _Compare&>(*this)(__x.first, __y);}
423 _LIBCPP_INLINE_VISIBILITY
424 bool operator()(const _Key& __x, const _CP& __y) const
425 {return static_cast<const _Compare&>(*this)(__x, __y.first);}
426 _LIBCPP_INLINE_VISIBILITY
427 bool operator()(const _Key& __x, const _Pp& __y) const
428 {return static_cast<const _Compare&>(*this)(__x, __y.first);}
429 _LIBCPP_INLINE_VISIBILITY
430 bool operator()(const _Key& __x, const _Key& __y) const
431 {return static_cast<const _Compare&>(*this)(__x, __y);}
434 template <class _Key, class _Tp, class _Compare>
435 class __map_value_compare<_Key, _Tp, _Compare, false>
439 typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
440 typedef pair<const _Key, _Tp> _CP;
443 _LIBCPP_INLINE_VISIBILITY
444 __map_value_compare()
445 _NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
447 _LIBCPP_INLINE_VISIBILITY
448 __map_value_compare(_Compare c)
449 _NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
451 _LIBCPP_INLINE_VISIBILITY
452 const _Compare& key_comp() const _NOEXCEPT {return comp;}
454 _LIBCPP_INLINE_VISIBILITY
455 bool operator()(const _CP& __x, const _CP& __y) const
456 {return comp(__x.first, __y.first);}
457 _LIBCPP_INLINE_VISIBILITY
458 bool operator()(const _CP& __x, const _Pp& __y) const
459 {return comp(__x.first, __y.first);}
460 _LIBCPP_INLINE_VISIBILITY
461 bool operator()(const _CP& __x, const _Key& __y) const
462 {return comp(__x.first, __y);}
463 _LIBCPP_INLINE_VISIBILITY
464 bool operator()(const _Pp& __x, const _CP& __y) const
465 {return comp(__x.first, __y.first);}
466 _LIBCPP_INLINE_VISIBILITY
467 bool operator()(const _Pp& __x, const _Pp& __y) const
468 {return comp(__x.first, __y.first);}
469 _LIBCPP_INLINE_VISIBILITY
470 bool operator()(const _Pp& __x, const _Key& __y) const
471 {return comp(__x.first, __y);}
472 _LIBCPP_INLINE_VISIBILITY
473 bool operator()(const _Key& __x, const _CP& __y) const
474 {return comp(__x, __y.first);}
475 _LIBCPP_INLINE_VISIBILITY
476 bool operator()(const _Key& __x, const _Pp& __y) const
477 {return comp(__x, __y.first);}
478 _LIBCPP_INLINE_VISIBILITY
479 bool operator()(const _Key& __x, const _Key& __y) const
480 {return comp(__x, __y);}
483 template <class _Allocator>
484 class __map_node_destructor
486 typedef _Allocator allocator_type;
487 typedef allocator_traits<allocator_type> __alloc_traits;
488 typedef typename __alloc_traits::value_type::value_type value_type;
490 typedef typename __alloc_traits::pointer pointer;
492 typedef typename value_type::first_type first_type;
493 typedef typename value_type::second_type second_type;
495 allocator_type& __na_;
497 __map_node_destructor& operator=(const __map_node_destructor&);
500 bool __first_constructed;
501 bool __second_constructed;
503 _LIBCPP_INLINE_VISIBILITY
504 explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT
506 __first_constructed(false),
507 __second_constructed(false)
510 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
511 _LIBCPP_INLINE_VISIBILITY
512 __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT
514 __first_constructed(__x.__value_constructed),
515 __second_constructed(__x.__value_constructed)
517 __x.__value_constructed = false;
519 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
521 _LIBCPP_INLINE_VISIBILITY
522 void operator()(pointer __p) _NOEXCEPT
524 if (__second_constructed)
525 __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
526 if (__first_constructed)
527 __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
529 __alloc_traits::deallocate(__na_, __p, 1);
533 template <class _Key, class _Tp, class _Compare, class _Allocator>
535 template <class _Key, class _Tp, class _Compare, class _Allocator>
537 template <class _TreeIterator> class __map_const_iterator;
539 template <class _TreeIterator>
540 class _LIBCPP_VISIBLE __map_iterator
544 typedef typename _TreeIterator::__pointer_traits __pointer_traits;
545 typedef const typename _TreeIterator::value_type::first_type __key_type;
546 typedef typename _TreeIterator::value_type::second_type __mapped_type;
548 typedef bidirectional_iterator_tag iterator_category;
549 typedef pair<__key_type, __mapped_type> value_type;
550 typedef typename _TreeIterator::difference_type difference_type;
551 typedef value_type& reference;
552 typedef typename __pointer_traits::template
553 #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
556 rebind<value_type>::other
560 _LIBCPP_INLINE_VISIBILITY
561 __map_iterator() _NOEXCEPT {}
563 _LIBCPP_INLINE_VISIBILITY
564 __map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
566 _LIBCPP_INLINE_VISIBILITY
567 reference operator*() const {return *operator->();}
568 _LIBCPP_INLINE_VISIBILITY
569 pointer operator->() const {return (pointer)__i_.operator->();}
571 _LIBCPP_INLINE_VISIBILITY
572 __map_iterator& operator++() {++__i_; return *this;}
573 _LIBCPP_INLINE_VISIBILITY
574 __map_iterator operator++(int)
576 __map_iterator __t(*this);
581 _LIBCPP_INLINE_VISIBILITY
582 __map_iterator& operator--() {--__i_; return *this;}
583 _LIBCPP_INLINE_VISIBILITY
584 __map_iterator operator--(int)
586 __map_iterator __t(*this);
591 friend _LIBCPP_INLINE_VISIBILITY
592 bool operator==(const __map_iterator& __x, const __map_iterator& __y)
593 {return __x.__i_ == __y.__i_;}
595 _LIBCPP_INLINE_VISIBILITY
596 bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
597 {return __x.__i_ != __y.__i_;}
599 template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
600 template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
601 template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
604 template <class _TreeIterator>
605 class _LIBCPP_VISIBLE __map_const_iterator
609 typedef typename _TreeIterator::__pointer_traits __pointer_traits;
610 typedef const typename _TreeIterator::value_type::first_type __key_type;
611 typedef typename _TreeIterator::value_type::second_type __mapped_type;
613 typedef bidirectional_iterator_tag iterator_category;
614 typedef pair<__key_type, __mapped_type> value_type;
615 typedef typename _TreeIterator::difference_type difference_type;
616 typedef const value_type& reference;
617 typedef typename __pointer_traits::template
618 #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
619 rebind<const value_type>
621 rebind<const value_type>::other
625 _LIBCPP_INLINE_VISIBILITY
626 __map_const_iterator() _NOEXCEPT {}
628 _LIBCPP_INLINE_VISIBILITY
629 __map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
630 _LIBCPP_INLINE_VISIBILITY
631 __map_const_iterator(
632 __map_iterator<typename _TreeIterator::__non_const_iterator> __i)
636 _LIBCPP_INLINE_VISIBILITY
637 reference operator*() const {return *operator->();}
638 _LIBCPP_INLINE_VISIBILITY
639 pointer operator->() const {return (pointer)__i_.operator->();}
641 _LIBCPP_INLINE_VISIBILITY
642 __map_const_iterator& operator++() {++__i_; return *this;}
643 _LIBCPP_INLINE_VISIBILITY
644 __map_const_iterator operator++(int)
646 __map_const_iterator __t(*this);
651 _LIBCPP_INLINE_VISIBILITY
652 __map_const_iterator& operator--() {--__i_; return *this;}
653 _LIBCPP_INLINE_VISIBILITY
654 __map_const_iterator operator--(int)
656 __map_const_iterator __t(*this);
661 friend _LIBCPP_INLINE_VISIBILITY
662 bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y)
663 {return __x.__i_ == __y.__i_;}
664 friend _LIBCPP_INLINE_VISIBILITY
665 bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
666 {return __x.__i_ != __y.__i_;}
668 template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
669 template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
670 template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
673 template <class _Key, class _Tp, class _Compare = less<_Key>,
674 class _Allocator = allocator<pair<const _Key, _Tp> > >
675 class _LIBCPP_VISIBLE map
679 typedef _Key key_type;
680 typedef _Tp mapped_type;
681 typedef pair<const key_type, mapped_type> value_type;
682 typedef _Compare key_compare;
683 typedef _Allocator allocator_type;
684 typedef value_type& reference;
685 typedef const value_type& const_reference;
687 class _LIBCPP_VISIBLE value_compare
688 : public binary_function<value_type, value_type, bool>
694 _LIBCPP_INLINE_VISIBILITY value_compare(key_compare c) : comp(c) {}
696 _LIBCPP_INLINE_VISIBILITY
697 bool operator()(const value_type& __x, const value_type& __y) const
698 {return comp(__x.first, __y.first);}
702 typedef pair<key_type, mapped_type> __value_type;
703 typedef __map_value_compare<key_type, mapped_type, key_compare> __vc;
704 typedef typename allocator_traits<allocator_type>::template
705 #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
706 rebind_alloc<__value_type>
708 rebind_alloc<__value_type>::other
711 typedef __tree<__value_type, __vc, __allocator_type> __base;
712 typedef typename __base::__node_traits __node_traits;
713 typedef allocator_traits<allocator_type> __alloc_traits;
718 typedef typename __alloc_traits::pointer pointer;
719 typedef typename __alloc_traits::const_pointer const_pointer;
720 typedef typename __alloc_traits::size_type size_type;
721 typedef typename __alloc_traits::difference_type difference_type;
722 typedef __map_iterator<typename __base::iterator> iterator;
723 typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
724 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
725 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
727 _LIBCPP_INLINE_VISIBILITY
728 explicit map(const key_compare& __comp = key_compare())
730 is_nothrow_default_constructible<allocator_type>::value &&
731 is_nothrow_default_constructible<key_compare>::value &&
732 is_nothrow_copy_constructible<key_compare>::value)
733 : __tree_(__vc(__comp)) {}
735 _LIBCPP_INLINE_VISIBILITY
736 explicit map(const key_compare& __comp, const allocator_type& __a)
737 : __tree_(__vc(__comp), __a) {}
739 template <class _InputIterator>
740 _LIBCPP_INLINE_VISIBILITY
741 map(_InputIterator __f, _InputIterator __l,
742 const key_compare& __comp = key_compare())
743 : __tree_(__vc(__comp))
748 template <class _InputIterator>
749 _LIBCPP_INLINE_VISIBILITY
750 map(_InputIterator __f, _InputIterator __l,
751 const key_compare& __comp, const allocator_type& __a)
752 : __tree_(__vc(__comp), __a)
757 _LIBCPP_INLINE_VISIBILITY
759 : __tree_(__m.__tree_)
761 insert(__m.begin(), __m.end());
764 _LIBCPP_INLINE_VISIBILITY
765 map& operator=(const map& __m)
767 __tree_ = __m.__tree_;
771 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
773 _LIBCPP_INLINE_VISIBILITY
775 _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
776 : __tree_(_VSTD::move(__m.__tree_))
780 map(map&& __m, const allocator_type& __a);
782 _LIBCPP_INLINE_VISIBILITY
783 map& operator=(map&& __m)
784 _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
786 __tree_ = _VSTD::move(__m.__tree_);
790 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
792 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
794 _LIBCPP_INLINE_VISIBILITY
795 map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
796 : __tree_(__vc(__comp))
798 insert(__il.begin(), __il.end());
801 _LIBCPP_INLINE_VISIBILITY
802 map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
803 : __tree_(__vc(__comp), __a)
805 insert(__il.begin(), __il.end());
808 _LIBCPP_INLINE_VISIBILITY
809 map& operator=(initializer_list<value_type> __il)
811 __tree_.__assign_unique(__il.begin(), __il.end());
815 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
817 _LIBCPP_INLINE_VISIBILITY
818 explicit map(const allocator_type& __a)
823 _LIBCPP_INLINE_VISIBILITY
824 map(const map& __m, const allocator_type& __a)
825 : __tree_(__m.__tree_.value_comp(), __a)
827 insert(__m.begin(), __m.end());
830 _LIBCPP_INLINE_VISIBILITY
831 iterator begin() _NOEXCEPT {return __tree_.begin();}
832 _LIBCPP_INLINE_VISIBILITY
833 const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
834 _LIBCPP_INLINE_VISIBILITY
835 iterator end() _NOEXCEPT {return __tree_.end();}
836 _LIBCPP_INLINE_VISIBILITY
837 const_iterator end() const _NOEXCEPT {return __tree_.end();}
839 _LIBCPP_INLINE_VISIBILITY
840 reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
841 _LIBCPP_INLINE_VISIBILITY
842 const_reverse_iterator rbegin() const _NOEXCEPT
843 {return const_reverse_iterator(end());}
844 _LIBCPP_INLINE_VISIBILITY
845 reverse_iterator rend() _NOEXCEPT
846 {return reverse_iterator(begin());}
847 _LIBCPP_INLINE_VISIBILITY
848 const_reverse_iterator rend() const _NOEXCEPT
849 {return const_reverse_iterator(begin());}
851 _LIBCPP_INLINE_VISIBILITY
852 const_iterator cbegin() const _NOEXCEPT {return begin();}
853 _LIBCPP_INLINE_VISIBILITY
854 const_iterator cend() const _NOEXCEPT {return end();}
855 _LIBCPP_INLINE_VISIBILITY
856 const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
857 _LIBCPP_INLINE_VISIBILITY
858 const_reverse_iterator crend() const _NOEXCEPT {return rend();}
860 _LIBCPP_INLINE_VISIBILITY
861 bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
862 _LIBCPP_INLINE_VISIBILITY
863 size_type size() const _NOEXCEPT {return __tree_.size();}
864 _LIBCPP_INLINE_VISIBILITY
865 size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
867 mapped_type& operator[](const key_type& __k);
868 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
869 mapped_type& operator[](key_type&& __k);
872 mapped_type& at(const key_type& __k);
873 const mapped_type& at(const key_type& __k) const;
875 _LIBCPP_INLINE_VISIBILITY
876 allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
877 _LIBCPP_INLINE_VISIBILITY
878 key_compare key_comp() const {return __tree_.value_comp().key_comp();}
879 _LIBCPP_INLINE_VISIBILITY
880 value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
882 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
884 _LIBCPP_INLINE_VISIBILITY
886 emplace() {return __tree_.__emplace_unique();}
889 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
890 _LIBCPP_INLINE_VISIBILITY
893 {return __tree_.__emplace_unique(_VSTD::forward<_A0>(__a0));}
895 #ifndef _LIBCPP_HAS_NO_VARIADICS
897 template <class _A0, class ..._Args,
898 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
900 emplace(_A0&& __a0, _Args&& ...__args);
902 #endif // _LIBCPP_HAS_NO_VARIADICS
904 _LIBCPP_INLINE_VISIBILITY
906 emplace_hint(const_iterator __p)
907 {return __tree_.__emplace_hint_unique(__p.__i_);}
910 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
911 _LIBCPP_INLINE_VISIBILITY
913 emplace_hint(const_iterator __p, _A0&& __a0)
914 {return __tree_.__emplace_hint_unique(__p.__i_, _VSTD::forward<_A0>(__a0));}
916 #ifndef _LIBCPP_HAS_NO_VARIADICS
918 template <class _A0, class ..._Args,
919 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
921 emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
923 #endif // _LIBCPP_HAS_NO_VARIADICS
926 class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
927 _LIBCPP_INLINE_VISIBILITY
928 pair<iterator, bool> insert(_Pp&& __p)
929 {return __tree_.__insert_unique(_VSTD::forward<_Pp>(__p));}
932 class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
933 _LIBCPP_INLINE_VISIBILITY
934 iterator insert(const_iterator __pos, _Pp&& __p)
935 {return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_Pp>(__p));}
937 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
939 _LIBCPP_INLINE_VISIBILITY
941 insert(const value_type& __v) {return __tree_.__insert_unique(__v);}
943 _LIBCPP_INLINE_VISIBILITY
945 insert(const_iterator __p, const value_type& __v)
946 {return __tree_.__insert_unique(__p.__i_, __v);}
948 template <class _InputIterator>
949 _LIBCPP_INLINE_VISIBILITY
950 void insert(_InputIterator __f, _InputIterator __l)
952 for (const_iterator __e = cend(); __f != __l; ++__f)
953 insert(__e.__i_, *__f);
956 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
958 _LIBCPP_INLINE_VISIBILITY
959 void insert(initializer_list<value_type> __il)
960 {insert(__il.begin(), __il.end());}
962 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
964 _LIBCPP_INLINE_VISIBILITY
965 iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
966 _LIBCPP_INLINE_VISIBILITY
967 size_type erase(const key_type& __k)
968 {return __tree_.__erase_unique(__k);}
969 _LIBCPP_INLINE_VISIBILITY
970 iterator erase(const_iterator __f, const_iterator __l)
971 {return __tree_.erase(__f.__i_, __l.__i_);}
972 _LIBCPP_INLINE_VISIBILITY
973 void clear() _NOEXCEPT {__tree_.clear();}
975 _LIBCPP_INLINE_VISIBILITY
977 _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
978 {__tree_.swap(__m.__tree_);}
980 _LIBCPP_INLINE_VISIBILITY
981 iterator find(const key_type& __k) {return __tree_.find(__k);}
982 _LIBCPP_INLINE_VISIBILITY
983 const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
984 _LIBCPP_INLINE_VISIBILITY
985 size_type count(const key_type& __k) const
986 {return __tree_.__count_unique(__k);}
987 _LIBCPP_INLINE_VISIBILITY
988 iterator lower_bound(const key_type& __k)
989 {return __tree_.lower_bound(__k);}
990 _LIBCPP_INLINE_VISIBILITY
991 const_iterator lower_bound(const key_type& __k) const
992 {return __tree_.lower_bound(__k);}
993 _LIBCPP_INLINE_VISIBILITY
994 iterator upper_bound(const key_type& __k)
995 {return __tree_.upper_bound(__k);}
996 _LIBCPP_INLINE_VISIBILITY
997 const_iterator upper_bound(const key_type& __k) const
998 {return __tree_.upper_bound(__k);}
999 _LIBCPP_INLINE_VISIBILITY
1000 pair<iterator,iterator> equal_range(const key_type& __k)
1001 {return __tree_.__equal_range_unique(__k);}
1002 _LIBCPP_INLINE_VISIBILITY
1003 pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
1004 {return __tree_.__equal_range_unique(__k);}
1007 typedef typename __base::__node __node;
1008 typedef typename __base::__node_allocator __node_allocator;
1009 typedef typename __base::__node_pointer __node_pointer;
1010 typedef typename __base::__node_const_pointer __node_const_pointer;
1011 typedef typename __base::__node_base_pointer __node_base_pointer;
1012 typedef typename __base::__node_base_const_pointer __node_base_const_pointer;
1013 typedef __map_node_destructor<__node_allocator> _Dp;
1014 typedef unique_ptr<__node, _Dp> __node_holder;
1016 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1017 __node_holder __construct_node();
1018 template <class _A0,
1019 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
1020 __node_holder __construct_node(_A0&& __a0);
1021 #ifndef _LIBCPP_HAS_NO_VARIADICS
1022 template <class _A0, class ..._Args,
1023 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
1024 __node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
1025 #endif // _LIBCPP_HAS_NO_VARIADICS
1026 #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1027 __node_holder __construct_node(const key_type& __k);
1030 __node_base_pointer&
1031 __find_equal_key(__node_base_pointer& __parent, const key_type& __k);
1032 __node_base_pointer&
1033 __find_equal_key(const_iterator __hint,
1034 __node_base_pointer& __parent, const key_type& __k);
1035 __node_base_const_pointer
1036 __find_equal_key(__node_base_const_pointer& __parent, const key_type& __k) const;
1039 // Find place to insert if __k doesn't exist
1040 // Set __parent to parent of null leaf
1041 // Return reference to null leaf
1042 // If __k exists, set parent to node of __k and return reference to node of __k
1043 template <class _Key, class _Tp, class _Compare, class _Allocator>
1044 typename map<_Key, _Tp, _Compare, _Allocator>::__node_base_pointer&
1045 map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(__node_base_pointer& __parent,
1046 const key_type& __k)
1048 __node_pointer __nd = __tree_.__root();
1049 if (__nd != nullptr)
1053 if (__tree_.value_comp().key_comp()(__k, __nd->__value_.first))
1055 if (__nd->__left_ != nullptr)
1056 __nd = static_cast<__node_pointer>(__nd->__left_);
1060 return __parent->__left_;
1063 else if (__tree_.value_comp().key_comp()(__nd->__value_.first, __k))
1065 if (__nd->__right_ != nullptr)
1066 __nd = static_cast<__node_pointer>(__nd->__right_);
1070 return __parent->__right_;
1080 __parent = __tree_.__end_node();
1081 return __parent->__left_;
1084 // Find place to insert if __k doesn't exist
1085 // First check prior to __hint.
1086 // Next check after __hint.
1087 // Next do O(log N) search.
1088 // Set __parent to parent of null leaf
1089 // Return reference to null leaf
1090 // If __k exists, set parent to node of __k and return reference to node of __k
1091 template <class _Key, class _Tp, class _Compare, class _Allocator>
1092 typename map<_Key, _Tp, _Compare, _Allocator>::__node_base_pointer&
1093 map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(const_iterator __hint,
1094 __node_base_pointer& __parent,
1095 const key_type& __k)
1097 if (__hint == end() || __tree_.value_comp().key_comp()(__k, __hint->first)) // check before
1100 const_iterator __prior = __hint;
1101 if (__prior == begin() || __tree_.value_comp().key_comp()((--__prior)->first, __k))
1103 // *prev(__hint) < __k < *__hint
1104 if (__hint.__ptr_->__left_ == nullptr)
1106 __parent = const_cast<__node_pointer&>(__hint.__ptr_);
1107 return __parent->__left_;
1111 __parent = const_cast<__node_pointer&>(__prior.__ptr_);
1112 return __parent->__right_;
1115 // __k <= *prev(__hint)
1116 return __find_equal_key(__parent, __k);
1118 else if (__tree_.value_comp().key_comp()(__hint->first, __k)) // check after
1121 const_iterator __next = _VSTD::next(__hint);
1122 if (__next == end() || __tree_.value_comp().key_comp()(__k, __next->first))
1124 // *__hint < __k < *next(__hint)
1125 if (__hint.__ptr_->__right_ == nullptr)
1127 __parent = const_cast<__node_pointer&>(__hint.__ptr_);
1128 return __parent->__right_;
1132 __parent = const_cast<__node_pointer&>(__next.__ptr_);
1133 return __parent->__left_;
1136 // *next(__hint) <= __k
1137 return __find_equal_key(__parent, __k);
1139 // else __k == *__hint
1140 __parent = const_cast<__node_pointer&>(__hint.__ptr_);
1145 // Set __parent to parent of null leaf and
1146 // return reference to null leaf iv __k does not exist.
1147 // If __k exists, set parent to node of __k and return reference to node of __k
1148 template <class _Key, class _Tp, class _Compare, class _Allocator>
1149 typename map<_Key, _Tp, _Compare, _Allocator>::__node_base_const_pointer
1150 map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(__node_base_const_pointer& __parent,
1151 const key_type& __k) const
1153 __node_const_pointer __nd = __tree_.__root();
1154 if (__nd != nullptr)
1158 if (__tree_.value_comp().key_comp()(__k, __nd->__value_.first))
1160 if (__nd->__left_ != nullptr)
1161 __nd = static_cast<__node_pointer>(__nd->__left_);
1165 return const_cast<const __node_base_const_pointer&>(__parent->__left_);
1168 else if (__tree_.value_comp().key_comp()(__nd->__value_.first, __k))
1170 if (__nd->__right_ != nullptr)
1171 __nd = static_cast<__node_pointer>(__nd->__right_);
1175 return const_cast<const __node_base_const_pointer&>(__parent->__right_);
1185 __parent = __tree_.__end_node();
1186 return const_cast<const __node_base_const_pointer&>(__parent->__left_);
1189 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1191 template <class _Key, class _Tp, class _Compare, class _Allocator>
1192 map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
1193 : __tree_(_VSTD::move(__m.__tree_), __a)
1195 if (__a != __m.get_allocator())
1197 const_iterator __e = cend();
1198 while (!__m.empty())
1199 __tree_.__insert_unique(__e.__i_,
1200 _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
1204 template <class _Key, class _Tp, class _Compare, class _Allocator>
1205 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
1206 map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
1208 __node_allocator& __na = __tree_.__node_alloc();
1209 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1210 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
1211 __h.get_deleter().__first_constructed = true;
1212 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
1213 __h.get_deleter().__second_constructed = true;
1217 template <class _Key, class _Tp, class _Compare, class _Allocator>
1218 template <class _A0,
1220 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
1221 map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
1223 __node_allocator& __na = __tree_.__node_alloc();
1224 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1225 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
1226 __h.get_deleter().__first_constructed = true;
1227 __h.get_deleter().__second_constructed = true;
1231 #ifndef _LIBCPP_HAS_NO_VARIADICS
1233 template <class _Key, class _Tp, class _Compare, class _Allocator>
1234 template <class _A0, class ..._Args,
1236 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
1237 map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
1239 __node_allocator& __na = __tree_.__node_alloc();
1240 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1241 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
1242 __h.get_deleter().__first_constructed = true;
1243 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
1244 __h.get_deleter().__second_constructed = true;
1248 #endif // _LIBCPP_HAS_NO_VARIADICS
1250 #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1252 template <class _Key, class _Tp, class _Compare, class _Allocator>
1253 typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
1254 map<_Key, _Tp, _Compare, _Allocator>::__construct_node(const key_type& __k)
1256 __node_allocator& __na = __tree_.__node_alloc();
1257 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1258 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
1259 __h.get_deleter().__first_constructed = true;
1260 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
1261 __h.get_deleter().__second_constructed = true;
1262 return _VSTD::move(__h);
1265 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1267 template <class _Key, class _Tp, class _Compare, class _Allocator>
1269 map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
1271 __node_base_pointer __parent;
1272 __node_base_pointer& __child = __find_equal_key(__parent, __k);
1273 __node_pointer __r = static_cast<__node_pointer>(__child);
1274 if (__child == nullptr)
1276 __node_holder __h = __construct_node(__k);
1277 __tree_.__insert_node_at(__parent, __child, __h.get());
1278 __r = __h.release();
1280 return __r->__value_.second;
1283 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1285 template <class _Key, class _Tp, class _Compare, class _Allocator>
1287 map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
1289 __node_base_pointer __parent;
1290 __node_base_pointer& __child = __find_equal_key(__parent, __k);
1291 __node_pointer __r = static_cast<__node_pointer>(__child);
1292 if (__child == nullptr)
1294 __node_holder __h = __construct_node(_VSTD::move(__k));
1295 __tree_.__insert_node_at(__parent, __child, __h.get());
1296 __r = __h.release();
1298 return __r->__value_.second;
1301 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1303 template <class _Key, class _Tp, class _Compare, class _Allocator>
1305 map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)
1307 __node_base_pointer __parent;
1308 __node_base_pointer& __child = __find_equal_key(__parent, __k);
1309 #ifndef _LIBCPP_NO_EXCEPTIONS
1310 if (__child == nullptr)
1311 throw out_of_range("map::at: key not found");
1312 #endif // _LIBCPP_NO_EXCEPTIONS
1313 return static_cast<__node_pointer>(__child)->__value_.second;
1316 template <class _Key, class _Tp, class _Compare, class _Allocator>
1318 map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
1320 __node_base_const_pointer __parent;
1321 __node_base_const_pointer __child = __find_equal_key(__parent, __k);
1322 #ifndef _LIBCPP_NO_EXCEPTIONS
1323 if (__child == nullptr)
1324 throw out_of_range("map::at: key not found");
1325 #endif // _LIBCPP_NO_EXCEPTIONS
1326 return static_cast<__node_const_pointer>(__child)->__value_.second;
1329 #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
1331 template <class _Key, class _Tp, class _Compare, class _Allocator>
1332 template <class _A0, class ..._Args,
1333 class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
1335 pair<typename map<_Key, _Tp, _Compare, _Allocator>::iterator, bool>
1336 map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
1338 __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
1339 _VSTD::forward<_Args>(__args)...);
1340 pair<iterator, bool> __r = __tree_.__node_insert_unique(__h.get());
1346 template <class _Key, class _Tp, class _Compare, class _Allocator>
1347 template <class _A0, class ..._Args,
1348 class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
1350 typename map<_Key, _Tp, _Compare, _Allocator>::iterator
1351 map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
1352 _A0&& __a0, _Args&& ...__args)
1354 __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
1355 _VSTD::forward<_Args>(__args)...);
1356 iterator __r = __tree_.__node_insert_unique(__p.__i_, __h.get());
1357 if (__r.__i_.__ptr_ == __h.get())
1362 #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
1364 template <class _Key, class _Tp, class _Compare, class _Allocator>
1365 inline _LIBCPP_INLINE_VISIBILITY
1367 operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1368 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1370 return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
1373 template <class _Key, class _Tp, class _Compare, class _Allocator>
1374 inline _LIBCPP_INLINE_VISIBILITY
1376 operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
1377 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1379 return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
1382 template <class _Key, class _Tp, class _Compare, class _Allocator>
1383 inline _LIBCPP_INLINE_VISIBILITY
1385 operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1386 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1388 return !(__x == __y);
1391 template <class _Key, class _Tp, class _Compare, class _Allocator>
1392 inline _LIBCPP_INLINE_VISIBILITY
1394 operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x,
1395 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1400 template <class _Key, class _Tp, class _Compare, class _Allocator>
1401 inline _LIBCPP_INLINE_VISIBILITY
1403 operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1404 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1406 return !(__x < __y);
1409 template <class _Key, class _Tp, class _Compare, class _Allocator>
1410 inline _LIBCPP_INLINE_VISIBILITY
1412 operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
1413 const map<_Key, _Tp, _Compare, _Allocator>& __y)
1415 return !(__y < __x);
1418 template <class _Key, class _Tp, class _Compare, class _Allocator>
1419 inline _LIBCPP_INLINE_VISIBILITY
1421 swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
1422 map<_Key, _Tp, _Compare, _Allocator>& __y)
1423 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
1428 template <class _Key, class _Tp, class _Compare = less<_Key>,
1429 class _Allocator = allocator<pair<const _Key, _Tp> > >
1430 class _LIBCPP_VISIBLE multimap
1434 typedef _Key key_type;
1435 typedef _Tp mapped_type;
1436 typedef pair<const key_type, mapped_type> value_type;
1437 typedef _Compare key_compare;
1438 typedef _Allocator allocator_type;
1439 typedef value_type& reference;
1440 typedef const value_type& const_reference;
1442 class _LIBCPP_VISIBLE value_compare
1443 : public binary_function<value_type, value_type, bool>
1445 friend class multimap;
1449 _LIBCPP_INLINE_VISIBILITY
1450 value_compare(key_compare c) : comp(c) {}
1452 _LIBCPP_INLINE_VISIBILITY
1453 bool operator()(const value_type& __x, const value_type& __y) const
1454 {return comp(__x.first, __y.first);}
1458 typedef pair<key_type, mapped_type> __value_type;
1459 typedef __map_value_compare<key_type, mapped_type, key_compare> __vc;
1460 typedef typename allocator_traits<allocator_type>::template
1461 #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
1462 rebind_alloc<__value_type>
1464 rebind_alloc<__value_type>::other
1467 typedef __tree<__value_type, __vc, __allocator_type> __base;
1468 typedef typename __base::__node_traits __node_traits;
1469 typedef allocator_traits<allocator_type> __alloc_traits;
1474 typedef typename __alloc_traits::pointer pointer;
1475 typedef typename __alloc_traits::const_pointer const_pointer;
1476 typedef typename __alloc_traits::size_type size_type;
1477 typedef typename __alloc_traits::difference_type difference_type;
1478 typedef __map_iterator<typename __base::iterator> iterator;
1479 typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
1480 typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
1481 typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
1483 _LIBCPP_INLINE_VISIBILITY
1484 explicit multimap(const key_compare& __comp = key_compare())
1486 is_nothrow_default_constructible<allocator_type>::value &&
1487 is_nothrow_default_constructible<key_compare>::value &&
1488 is_nothrow_copy_constructible<key_compare>::value)
1489 : __tree_(__vc(__comp)) {}
1491 _LIBCPP_INLINE_VISIBILITY
1492 explicit multimap(const key_compare& __comp, const allocator_type& __a)
1493 : __tree_(__vc(__comp), __a) {}
1495 template <class _InputIterator>
1496 _LIBCPP_INLINE_VISIBILITY
1497 multimap(_InputIterator __f, _InputIterator __l,
1498 const key_compare& __comp = key_compare())
1499 : __tree_(__vc(__comp))
1504 template <class _InputIterator>
1505 _LIBCPP_INLINE_VISIBILITY
1506 multimap(_InputIterator __f, _InputIterator __l,
1507 const key_compare& __comp, const allocator_type& __a)
1508 : __tree_(__vc(__comp), __a)
1513 _LIBCPP_INLINE_VISIBILITY
1514 multimap(const multimap& __m)
1515 : __tree_(__m.__tree_.value_comp(),
1516 __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc()))
1518 insert(__m.begin(), __m.end());
1521 _LIBCPP_INLINE_VISIBILITY
1522 multimap& operator=(const multimap& __m)
1524 __tree_ = __m.__tree_;
1528 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1530 _LIBCPP_INLINE_VISIBILITY
1531 multimap(multimap&& __m)
1532 _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
1533 : __tree_(_VSTD::move(__m.__tree_))
1537 multimap(multimap&& __m, const allocator_type& __a);
1539 _LIBCPP_INLINE_VISIBILITY
1540 multimap& operator=(multimap&& __m)
1541 _NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
1543 __tree_ = _VSTD::move(__m.__tree_);
1547 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1549 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1551 _LIBCPP_INLINE_VISIBILITY
1552 multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
1553 : __tree_(__vc(__comp))
1555 insert(__il.begin(), __il.end());
1558 _LIBCPP_INLINE_VISIBILITY
1559 multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
1560 : __tree_(__vc(__comp), __a)
1562 insert(__il.begin(), __il.end());
1565 _LIBCPP_INLINE_VISIBILITY
1566 multimap& operator=(initializer_list<value_type> __il)
1568 __tree_.__assign_multi(__il.begin(), __il.end());
1572 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1574 _LIBCPP_INLINE_VISIBILITY
1575 explicit multimap(const allocator_type& __a)
1580 _LIBCPP_INLINE_VISIBILITY
1581 multimap(const multimap& __m, const allocator_type& __a)
1582 : __tree_(__m.__tree_.value_comp(), __a)
1584 insert(__m.begin(), __m.end());
1587 _LIBCPP_INLINE_VISIBILITY
1588 iterator begin() _NOEXCEPT {return __tree_.begin();}
1589 _LIBCPP_INLINE_VISIBILITY
1590 const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
1591 _LIBCPP_INLINE_VISIBILITY
1592 iterator end() _NOEXCEPT {return __tree_.end();}
1593 _LIBCPP_INLINE_VISIBILITY
1594 const_iterator end() const _NOEXCEPT {return __tree_.end();}
1596 _LIBCPP_INLINE_VISIBILITY
1597 reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
1598 _LIBCPP_INLINE_VISIBILITY
1599 const_reverse_iterator rbegin() const _NOEXCEPT
1600 {return const_reverse_iterator(end());}
1601 _LIBCPP_INLINE_VISIBILITY
1602 reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
1603 _LIBCPP_INLINE_VISIBILITY
1604 const_reverse_iterator rend() const _NOEXCEPT
1605 {return const_reverse_iterator(begin());}
1607 _LIBCPP_INLINE_VISIBILITY
1608 const_iterator cbegin() const _NOEXCEPT {return begin();}
1609 _LIBCPP_INLINE_VISIBILITY
1610 const_iterator cend() const _NOEXCEPT {return end();}
1611 _LIBCPP_INLINE_VISIBILITY
1612 const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
1613 _LIBCPP_INLINE_VISIBILITY
1614 const_reverse_iterator crend() const _NOEXCEPT {return rend();}
1616 _LIBCPP_INLINE_VISIBILITY
1617 bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
1618 _LIBCPP_INLINE_VISIBILITY
1619 size_type size() const _NOEXCEPT {return __tree_.size();}
1620 _LIBCPP_INLINE_VISIBILITY
1621 size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
1623 _LIBCPP_INLINE_VISIBILITY
1624 allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
1625 _LIBCPP_INLINE_VISIBILITY
1626 key_compare key_comp() const {return __tree_.value_comp().key_comp();}
1627 _LIBCPP_INLINE_VISIBILITY
1628 value_compare value_comp() const
1629 {return value_compare(__tree_.value_comp().key_comp());}
1631 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1633 _LIBCPP_INLINE_VISIBILITY
1634 iterator emplace() {return __tree_.__emplace_multi();}
1636 template <class _A0,
1637 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
1638 _LIBCPP_INLINE_VISIBILITY
1641 {return __tree_.__emplace_multi(_VSTD::forward<_A0>(__a0));}
1643 #ifndef _LIBCPP_HAS_NO_VARIADICS
1645 template <class _A0, class ..._Args,
1646 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
1648 emplace(_A0&& __a0, _Args&& ...__args);
1650 #endif // _LIBCPP_HAS_NO_VARIADICS
1652 _LIBCPP_INLINE_VISIBILITY
1653 iterator emplace_hint(const_iterator __p)
1654 {return __tree_.__emplace_hint_multi(__p.__i_);}
1656 template <class _A0,
1657 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
1658 _LIBCPP_INLINE_VISIBILITY
1660 emplace_hint(const_iterator __p, _A0&& __a0)
1661 {return __tree_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_A0>(__a0));}
1663 #ifndef _LIBCPP_HAS_NO_VARIADICS
1665 template <class _A0, class ..._Args,
1666 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
1668 emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
1670 #endif // _LIBCPP_HAS_NO_VARIADICS
1672 template <class _Pp,
1673 class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
1674 _LIBCPP_INLINE_VISIBILITY
1675 iterator insert(_Pp&& __p)
1676 {return __tree_.__insert_multi(_VSTD::forward<_Pp>(__p));}
1678 template <class _Pp,
1679 class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
1680 _LIBCPP_INLINE_VISIBILITY
1681 iterator insert(const_iterator __pos, _Pp&& __p)
1682 {return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_Pp>(__p));}
1684 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1686 _LIBCPP_INLINE_VISIBILITY
1687 iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);}
1689 _LIBCPP_INLINE_VISIBILITY
1690 iterator insert(const_iterator __p, const value_type& __v)
1691 {return __tree_.__insert_multi(__p.__i_, __v);}
1693 template <class _InputIterator>
1694 _LIBCPP_INLINE_VISIBILITY
1695 void insert(_InputIterator __f, _InputIterator __l)
1697 for (const_iterator __e = cend(); __f != __l; ++__f)
1698 __tree_.__insert_multi(__e.__i_, *__f);
1701 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1703 _LIBCPP_INLINE_VISIBILITY
1704 void insert(initializer_list<value_type> __il)
1705 {insert(__il.begin(), __il.end());}
1707 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1709 _LIBCPP_INLINE_VISIBILITY
1710 iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
1711 _LIBCPP_INLINE_VISIBILITY
1712 size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
1713 _LIBCPP_INLINE_VISIBILITY
1714 iterator erase(const_iterator __f, const_iterator __l)
1715 {return __tree_.erase(__f.__i_, __l.__i_);}
1716 _LIBCPP_INLINE_VISIBILITY
1717 void clear() {__tree_.clear();}
1719 _LIBCPP_INLINE_VISIBILITY
1720 void swap(multimap& __m)
1721 _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
1722 {__tree_.swap(__m.__tree_);}
1724 _LIBCPP_INLINE_VISIBILITY
1725 iterator find(const key_type& __k) {return __tree_.find(__k);}
1726 _LIBCPP_INLINE_VISIBILITY
1727 const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
1728 _LIBCPP_INLINE_VISIBILITY
1729 size_type count(const key_type& __k) const
1730 {return __tree_.__count_multi(__k);}
1731 _LIBCPP_INLINE_VISIBILITY
1732 iterator lower_bound(const key_type& __k)
1733 {return __tree_.lower_bound(__k);}
1734 _LIBCPP_INLINE_VISIBILITY
1735 const_iterator lower_bound(const key_type& __k) const
1736 {return __tree_.lower_bound(__k);}
1737 _LIBCPP_INLINE_VISIBILITY
1738 iterator upper_bound(const key_type& __k)
1739 {return __tree_.upper_bound(__k);}
1740 _LIBCPP_INLINE_VISIBILITY
1741 const_iterator upper_bound(const key_type& __k) const
1742 {return __tree_.upper_bound(__k);}
1743 _LIBCPP_INLINE_VISIBILITY
1744 pair<iterator,iterator> equal_range(const key_type& __k)
1745 {return __tree_.__equal_range_multi(__k);}
1746 _LIBCPP_INLINE_VISIBILITY
1747 pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
1748 {return __tree_.__equal_range_multi(__k);}
1751 typedef typename __base::__node __node;
1752 typedef typename __base::__node_allocator __node_allocator;
1753 typedef typename __base::__node_pointer __node_pointer;
1754 typedef typename __base::__node_const_pointer __node_const_pointer;
1755 typedef __map_node_destructor<__node_allocator> _Dp;
1756 typedef unique_ptr<__node, _Dp> __node_holder;
1758 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1759 __node_holder __construct_node();
1760 template <class _A0,
1761 class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
1762 __node_holder __construct_node(_A0&& __a0);
1763 #ifndef _LIBCPP_HAS_NO_VARIADICS
1764 template <class _A0, class ..._Args,
1765 class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
1766 __node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
1767 #endif // _LIBCPP_HAS_NO_VARIADICS
1768 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1771 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1773 template <class _Key, class _Tp, class _Compare, class _Allocator>
1774 multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
1775 : __tree_(_VSTD::move(__m.__tree_), __a)
1777 if (__a != __m.get_allocator())
1779 const_iterator __e = cend();
1780 while (!__m.empty())
1781 __tree_.__insert_multi(__e.__i_,
1782 _VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
1786 template <class _Key, class _Tp, class _Compare, class _Allocator>
1787 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
1788 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
1790 __node_allocator& __na = __tree_.__node_alloc();
1791 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1792 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
1793 __h.get_deleter().__first_constructed = true;
1794 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
1795 __h.get_deleter().__second_constructed = true;
1799 template <class _Key, class _Tp, class _Compare, class _Allocator>
1800 template <class _A0,
1801 class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
1803 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
1804 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
1806 __node_allocator& __na = __tree_.__node_alloc();
1807 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1808 __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
1809 __h.get_deleter().__first_constructed = true;
1810 __h.get_deleter().__second_constructed = true;
1814 #ifndef _LIBCPP_HAS_NO_VARIADICS
1816 template <class _Key, class _Tp, class _Compare, class _Allocator>
1817 template <class _A0, class ..._Args,
1818 class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
1820 typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
1821 multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
1823 __node_allocator& __na = __tree_.__node_alloc();
1824 __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
1825 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
1826 __h.get_deleter().__first_constructed = true;
1827 __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
1828 __h.get_deleter().__second_constructed = true;
1832 #endif // _LIBCPP_HAS_NO_VARIADICS
1833 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1835 #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
1837 template <class _Key, class _Tp, class _Compare, class _Allocator>
1838 template <class _A0, class ..._Args,
1839 class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
1841 typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
1842 multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
1844 __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
1845 _VSTD::forward<_Args>(__args)...);
1846 iterator __r = __tree_.__node_insert_multi(__h.get());
1851 template <class _Key, class _Tp, class _Compare, class _Allocator>
1852 template <class _A0, class ..._Args,
1853 class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
1855 typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
1856 multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
1860 __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
1861 _VSTD::forward<_Args>(__args)...);
1862 iterator __r = __tree_.__node_insert_multi(__p.__i_, __h.get());
1867 #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
1869 template <class _Key, class _Tp, class _Compare, class _Allocator>
1870 inline _LIBCPP_INLINE_VISIBILITY
1872 operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1873 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1875 return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
1878 template <class _Key, class _Tp, class _Compare, class _Allocator>
1879 inline _LIBCPP_INLINE_VISIBILITY
1881 operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1882 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1884 return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
1887 template <class _Key, class _Tp, class _Compare, class _Allocator>
1888 inline _LIBCPP_INLINE_VISIBILITY
1890 operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1891 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1893 return !(__x == __y);
1896 template <class _Key, class _Tp, class _Compare, class _Allocator>
1897 inline _LIBCPP_INLINE_VISIBILITY
1899 operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1900 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1905 template <class _Key, class _Tp, class _Compare, class _Allocator>
1906 inline _LIBCPP_INLINE_VISIBILITY
1908 operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1909 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1911 return !(__x < __y);
1914 template <class _Key, class _Tp, class _Compare, class _Allocator>
1915 inline _LIBCPP_INLINE_VISIBILITY
1917 operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1918 const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1920 return !(__y < __x);
1923 template <class _Key, class _Tp, class _Compare, class _Allocator>
1924 inline _LIBCPP_INLINE_VISIBILITY
1926 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x,
1927 multimap<_Key, _Tp, _Compare, _Allocator>& __y)
1928 _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
1933 _LIBCPP_END_NAMESPACE_STD
1935 #endif // _LIBCPP_MAP