17a984708SDavid Chisnall// -*- C++ -*- 27a984708SDavid Chisnall//===---------------------------- set -------------------------------------===// 37a984708SDavid Chisnall// 47a984708SDavid Chisnall// The LLVM Compiler Infrastructure 57a984708SDavid Chisnall// 67a984708SDavid Chisnall// This file is dual licensed under the MIT and the University of Illinois Open 77a984708SDavid Chisnall// Source Licenses. See LICENSE.TXT for details. 87a984708SDavid Chisnall// 97a984708SDavid Chisnall//===----------------------------------------------------------------------===// 107a984708SDavid Chisnall 117a984708SDavid Chisnall#ifndef _LIBCPP_SET 127a984708SDavid Chisnall#define _LIBCPP_SET 137a984708SDavid Chisnall 147a984708SDavid Chisnall/* 157a984708SDavid Chisnall 167a984708SDavid Chisnall set synopsis 177a984708SDavid Chisnall 187a984708SDavid Chisnallnamespace std 197a984708SDavid Chisnall{ 207a984708SDavid Chisnall 217a984708SDavid Chisnalltemplate <class Key, class Compare = less<Key>, 227a984708SDavid Chisnall class Allocator = allocator<Key>> 237a984708SDavid Chisnallclass set 247a984708SDavid Chisnall{ 257a984708SDavid Chisnallpublic: 267a984708SDavid Chisnall // types: 277a984708SDavid Chisnall typedef Key key_type; 287a984708SDavid Chisnall typedef key_type value_type; 297a984708SDavid Chisnall typedef Compare key_compare; 307a984708SDavid Chisnall typedef key_compare value_compare; 317a984708SDavid Chisnall typedef Allocator allocator_type; 327a984708SDavid Chisnall typedef typename allocator_type::reference reference; 337a984708SDavid Chisnall typedef typename allocator_type::const_reference const_reference; 347a984708SDavid Chisnall typedef typename allocator_type::size_type size_type; 357a984708SDavid Chisnall typedef typename allocator_type::difference_type difference_type; 367a984708SDavid Chisnall typedef typename allocator_type::pointer pointer; 377a984708SDavid Chisnall typedef typename allocator_type::const_pointer const_pointer; 387a984708SDavid Chisnall 397a984708SDavid Chisnall typedef implementation-defined iterator; 407a984708SDavid Chisnall typedef implementation-defined const_iterator; 417a984708SDavid Chisnall typedef std::reverse_iterator<iterator> reverse_iterator; 427a984708SDavid Chisnall typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 434ba319b5SDimitry Andric typedef unspecified node_type; // C++17 444ba319b5SDimitry Andric typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17 457a984708SDavid Chisnall 467a984708SDavid Chisnall // construct/copy/destroy: 477a984708SDavid Chisnall set() 487a984708SDavid Chisnall noexcept( 497a984708SDavid Chisnall is_nothrow_default_constructible<allocator_type>::value && 507a984708SDavid Chisnall is_nothrow_default_constructible<key_compare>::value && 517a984708SDavid Chisnall is_nothrow_copy_constructible<key_compare>::value); 527a984708SDavid Chisnall explicit set(const value_compare& comp); 537a984708SDavid Chisnall set(const value_compare& comp, const allocator_type& a); 547a984708SDavid Chisnall template <class InputIterator> 557a984708SDavid Chisnall set(InputIterator first, InputIterator last, 567a984708SDavid Chisnall const value_compare& comp = value_compare()); 577a984708SDavid Chisnall template <class InputIterator> 587a984708SDavid Chisnall set(InputIterator first, InputIterator last, const value_compare& comp, 597a984708SDavid Chisnall const allocator_type& a); 607a984708SDavid Chisnall set(const set& s); 617a984708SDavid Chisnall set(set&& s) 627a984708SDavid Chisnall noexcept( 637a984708SDavid Chisnall is_nothrow_move_constructible<allocator_type>::value && 647a984708SDavid Chisnall is_nothrow_move_constructible<key_compare>::value); 657a984708SDavid Chisnall explicit set(const allocator_type& a); 667a984708SDavid Chisnall set(const set& s, const allocator_type& a); 677a984708SDavid Chisnall set(set&& s, const allocator_type& a); 687a984708SDavid Chisnall set(initializer_list<value_type> il, const value_compare& comp = value_compare()); 697a984708SDavid Chisnall set(initializer_list<value_type> il, const value_compare& comp, 707a984708SDavid Chisnall const allocator_type& a); 714f7ab58eSDimitry Andric template <class InputIterator> 724f7ab58eSDimitry Andric set(InputIterator first, InputIterator last, const allocator_type& a) 734f7ab58eSDimitry Andric : set(first, last, Compare(), a) {} // C++14 744f7ab58eSDimitry Andric set(initializer_list<value_type> il, const allocator_type& a) 754f7ab58eSDimitry Andric : set(il, Compare(), a) {} // C++14 767a984708SDavid Chisnall ~set(); 777a984708SDavid Chisnall 787a984708SDavid Chisnall set& operator=(const set& s); 797a984708SDavid Chisnall set& operator=(set&& s) 807a984708SDavid Chisnall noexcept( 817a984708SDavid Chisnall allocator_type::propagate_on_container_move_assignment::value && 827a984708SDavid Chisnall is_nothrow_move_assignable<allocator_type>::value && 837a984708SDavid Chisnall is_nothrow_move_assignable<key_compare>::value); 847a984708SDavid Chisnall set& operator=(initializer_list<value_type> il); 857a984708SDavid Chisnall 867a984708SDavid Chisnall // iterators: 877a984708SDavid Chisnall iterator begin() noexcept; 887a984708SDavid Chisnall const_iterator begin() const noexcept; 897a984708SDavid Chisnall iterator end() noexcept; 907a984708SDavid Chisnall const_iterator end() const noexcept; 917a984708SDavid Chisnall 927a984708SDavid Chisnall reverse_iterator rbegin() noexcept; 937a984708SDavid Chisnall const_reverse_iterator rbegin() const noexcept; 947a984708SDavid Chisnall reverse_iterator rend() noexcept; 957a984708SDavid Chisnall const_reverse_iterator rend() const noexcept; 967a984708SDavid Chisnall 977a984708SDavid Chisnall const_iterator cbegin() const noexcept; 987a984708SDavid Chisnall const_iterator cend() const noexcept; 997a984708SDavid Chisnall const_reverse_iterator crbegin() const noexcept; 1007a984708SDavid Chisnall const_reverse_iterator crend() const noexcept; 1017a984708SDavid Chisnall 1027a984708SDavid Chisnall // capacity: 1037a984708SDavid Chisnall bool empty() const noexcept; 1047a984708SDavid Chisnall size_type size() const noexcept; 1057a984708SDavid Chisnall size_type max_size() const noexcept; 1067a984708SDavid Chisnall 1077a984708SDavid Chisnall // modifiers: 1087a984708SDavid Chisnall template <class... Args> 1097a984708SDavid Chisnall pair<iterator, bool> emplace(Args&&... args); 1107a984708SDavid Chisnall template <class... Args> 1117a984708SDavid Chisnall iterator emplace_hint(const_iterator position, Args&&... args); 1127a984708SDavid Chisnall pair<iterator,bool> insert(const value_type& v); 1137a984708SDavid Chisnall pair<iterator,bool> insert(value_type&& v); 1147a984708SDavid Chisnall iterator insert(const_iterator position, const value_type& v); 1157a984708SDavid Chisnall iterator insert(const_iterator position, value_type&& v); 1167a984708SDavid Chisnall template <class InputIterator> 1177a984708SDavid Chisnall void insert(InputIterator first, InputIterator last); 1187a984708SDavid Chisnall void insert(initializer_list<value_type> il); 1197a984708SDavid Chisnall 1204ba319b5SDimitry Andric node_type extract(const_iterator position); // C++17 1214ba319b5SDimitry Andric node_type extract(const key_type& x); // C++17 1224ba319b5SDimitry Andric insert_return_type insert(node_type&& nh); // C++17 1234ba319b5SDimitry Andric iterator insert(const_iterator hint, node_type&& nh); // C++17 1244ba319b5SDimitry Andric 1257a984708SDavid Chisnall iterator erase(const_iterator position); 126854fa44bSDimitry Andric iterator erase(iterator position); // C++14 1277a984708SDavid Chisnall size_type erase(const key_type& k); 1287a984708SDavid Chisnall iterator erase(const_iterator first, const_iterator last); 1297a984708SDavid Chisnall void clear() noexcept; 1307a984708SDavid Chisnall 131*b5893f02SDimitry Andric template<class C2> 132*b5893f02SDimitry Andric void merge(set<Key, C2, Allocator>& source); // C++17 133*b5893f02SDimitry Andric template<class C2> 134*b5893f02SDimitry Andric void merge(set<Key, C2, Allocator>&& source); // C++17 135*b5893f02SDimitry Andric template<class C2> 136*b5893f02SDimitry Andric void merge(multiset<Key, C2, Allocator>& source); // C++17 137*b5893f02SDimitry Andric template<class C2> 138*b5893f02SDimitry Andric void merge(multiset<Key, C2, Allocator>&& source); // C++17 139*b5893f02SDimitry Andric 1407a984708SDavid Chisnall void swap(set& s) 1417a984708SDavid Chisnall noexcept( 1427a984708SDavid Chisnall __is_nothrow_swappable<key_compare>::value && 1437a984708SDavid Chisnall (!allocator_type::propagate_on_container_swap::value || 1447a984708SDavid Chisnall __is_nothrow_swappable<allocator_type>::value)); 1457a984708SDavid Chisnall 1467a984708SDavid Chisnall // observers: 1477a984708SDavid Chisnall allocator_type get_allocator() const noexcept; 1487a984708SDavid Chisnall key_compare key_comp() const; 1497a984708SDavid Chisnall value_compare value_comp() const; 1507a984708SDavid Chisnall 1517a984708SDavid Chisnall // set operations: 1527a984708SDavid Chisnall iterator find(const key_type& k); 1537a984708SDavid Chisnall const_iterator find(const key_type& k) const; 1544f7ab58eSDimitry Andric template<typename K> 1554f7ab58eSDimitry Andric iterator find(const K& x); 1564f7ab58eSDimitry Andric template<typename K> 1574f7ab58eSDimitry Andric const_iterator find(const K& x) const; // C++14 1584f7ab58eSDimitry Andric template<typename K> 1594f7ab58eSDimitry Andric size_type count(const K& x) const; // C++14 1604f7ab58eSDimitry Andric 1617a984708SDavid Chisnall size_type count(const key_type& k) const; 1627a984708SDavid Chisnall iterator lower_bound(const key_type& k); 1637a984708SDavid Chisnall const_iterator lower_bound(const key_type& k) const; 1644f7ab58eSDimitry Andric template<typename K> 1654f7ab58eSDimitry Andric iterator lower_bound(const K& x); // C++14 1664f7ab58eSDimitry Andric template<typename K> 1674f7ab58eSDimitry Andric const_iterator lower_bound(const K& x) const; // C++14 1684f7ab58eSDimitry Andric 1697a984708SDavid Chisnall iterator upper_bound(const key_type& k); 1707a984708SDavid Chisnall const_iterator upper_bound(const key_type& k) const; 1714f7ab58eSDimitry Andric template<typename K> 1724f7ab58eSDimitry Andric iterator upper_bound(const K& x); // C++14 1734f7ab58eSDimitry Andric template<typename K> 1744f7ab58eSDimitry Andric const_iterator upper_bound(const K& x) const; // C++14 1757a984708SDavid Chisnall pair<iterator,iterator> equal_range(const key_type& k); 1767a984708SDavid Chisnall pair<const_iterator,const_iterator> equal_range(const key_type& k) const; 1774f7ab58eSDimitry Andric template<typename K> 1784f7ab58eSDimitry Andric pair<iterator,iterator> equal_range(const K& x); // C++14 1794f7ab58eSDimitry Andric template<typename K> 1804f7ab58eSDimitry Andric pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 1817a984708SDavid Chisnall}; 1827a984708SDavid Chisnall 1837a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 1847a984708SDavid Chisnallbool 1857a984708SDavid Chisnalloperator==(const set<Key, Compare, Allocator>& x, 1867a984708SDavid Chisnall const set<Key, Compare, Allocator>& y); 1877a984708SDavid Chisnall 1887a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 1897a984708SDavid Chisnallbool 1907a984708SDavid Chisnalloperator< (const set<Key, Compare, Allocator>& x, 1917a984708SDavid Chisnall const set<Key, Compare, Allocator>& y); 1927a984708SDavid Chisnall 1937a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 1947a984708SDavid Chisnallbool 1957a984708SDavid Chisnalloperator!=(const set<Key, Compare, Allocator>& x, 1967a984708SDavid Chisnall const set<Key, Compare, Allocator>& y); 1977a984708SDavid Chisnall 1987a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 1997a984708SDavid Chisnallbool 2007a984708SDavid Chisnalloperator> (const set<Key, Compare, Allocator>& x, 2017a984708SDavid Chisnall const set<Key, Compare, Allocator>& y); 2027a984708SDavid Chisnall 2037a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 2047a984708SDavid Chisnallbool 2057a984708SDavid Chisnalloperator>=(const set<Key, Compare, Allocator>& x, 2067a984708SDavid Chisnall const set<Key, Compare, Allocator>& y); 2077a984708SDavid Chisnall 2087a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 2097a984708SDavid Chisnallbool 2107a984708SDavid Chisnalloperator<=(const set<Key, Compare, Allocator>& x, 2117a984708SDavid Chisnall const set<Key, Compare, Allocator>& y); 2127a984708SDavid Chisnall 2137a984708SDavid Chisnall// specialized algorithms: 2147a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 2157a984708SDavid Chisnallvoid 2167a984708SDavid Chisnallswap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y) 2177a984708SDavid Chisnall noexcept(noexcept(x.swap(y))); 2187a984708SDavid Chisnall 219*b5893f02SDimitry Andrictemplate <class Key, class Compare, class Allocator, class Predicate> 220*b5893f02SDimitry Andric void erase_if(set<Key, Compare, Allocator>& c, Predicate pred); // C++20 221*b5893f02SDimitry Andric 2227a984708SDavid Chisnalltemplate <class Key, class Compare = less<Key>, 2237a984708SDavid Chisnall class Allocator = allocator<Key>> 2247a984708SDavid Chisnallclass multiset 2257a984708SDavid Chisnall{ 2267a984708SDavid Chisnallpublic: 2277a984708SDavid Chisnall // types: 2287a984708SDavid Chisnall typedef Key key_type; 2297a984708SDavid Chisnall typedef key_type value_type; 2307a984708SDavid Chisnall typedef Compare key_compare; 2317a984708SDavid Chisnall typedef key_compare value_compare; 2327a984708SDavid Chisnall typedef Allocator allocator_type; 2337a984708SDavid Chisnall typedef typename allocator_type::reference reference; 2347a984708SDavid Chisnall typedef typename allocator_type::const_reference const_reference; 2357a984708SDavid Chisnall typedef typename allocator_type::size_type size_type; 2367a984708SDavid Chisnall typedef typename allocator_type::difference_type difference_type; 2377a984708SDavid Chisnall typedef typename allocator_type::pointer pointer; 2387a984708SDavid Chisnall typedef typename allocator_type::const_pointer const_pointer; 2397a984708SDavid Chisnall 2407a984708SDavid Chisnall typedef implementation-defined iterator; 2417a984708SDavid Chisnall typedef implementation-defined const_iterator; 2427a984708SDavid Chisnall typedef std::reverse_iterator<iterator> reverse_iterator; 2437a984708SDavid Chisnall typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 2444ba319b5SDimitry Andric typedef unspecified node_type; // C++17 2457a984708SDavid Chisnall 2467a984708SDavid Chisnall // construct/copy/destroy: 2477a984708SDavid Chisnall multiset() 2487a984708SDavid Chisnall noexcept( 2497a984708SDavid Chisnall is_nothrow_default_constructible<allocator_type>::value && 2507a984708SDavid Chisnall is_nothrow_default_constructible<key_compare>::value && 2517a984708SDavid Chisnall is_nothrow_copy_constructible<key_compare>::value); 2527a984708SDavid Chisnall explicit multiset(const value_compare& comp); 2537a984708SDavid Chisnall multiset(const value_compare& comp, const allocator_type& a); 2547a984708SDavid Chisnall template <class InputIterator> 2557a984708SDavid Chisnall multiset(InputIterator first, InputIterator last, 2567a984708SDavid Chisnall const value_compare& comp = value_compare()); 2577a984708SDavid Chisnall template <class InputIterator> 2587a984708SDavid Chisnall multiset(InputIterator first, InputIterator last, 2597a984708SDavid Chisnall const value_compare& comp, const allocator_type& a); 2607a984708SDavid Chisnall multiset(const multiset& s); 2617a984708SDavid Chisnall multiset(multiset&& s) 2627a984708SDavid Chisnall noexcept( 2637a984708SDavid Chisnall is_nothrow_move_constructible<allocator_type>::value && 2647a984708SDavid Chisnall is_nothrow_move_constructible<key_compare>::value); 2657a984708SDavid Chisnall explicit multiset(const allocator_type& a); 2667a984708SDavid Chisnall multiset(const multiset& s, const allocator_type& a); 2677a984708SDavid Chisnall multiset(multiset&& s, const allocator_type& a); 2687a984708SDavid Chisnall multiset(initializer_list<value_type> il, const value_compare& comp = value_compare()); 2697a984708SDavid Chisnall multiset(initializer_list<value_type> il, const value_compare& comp, 2707a984708SDavid Chisnall const allocator_type& a); 2714f7ab58eSDimitry Andric template <class InputIterator> 2724f7ab58eSDimitry Andric multiset(InputIterator first, InputIterator last, const allocator_type& a) 2734f7ab58eSDimitry Andric : set(first, last, Compare(), a) {} // C++14 2744f7ab58eSDimitry Andric multiset(initializer_list<value_type> il, const allocator_type& a) 2754f7ab58eSDimitry Andric : set(il, Compare(), a) {} // C++14 2767a984708SDavid Chisnall ~multiset(); 2777a984708SDavid Chisnall 2787a984708SDavid Chisnall multiset& operator=(const multiset& s); 2797a984708SDavid Chisnall multiset& operator=(multiset&& s) 2807a984708SDavid Chisnall noexcept( 2817a984708SDavid Chisnall allocator_type::propagate_on_container_move_assignment::value && 2827a984708SDavid Chisnall is_nothrow_move_assignable<allocator_type>::value && 2837a984708SDavid Chisnall is_nothrow_move_assignable<key_compare>::value); 2847a984708SDavid Chisnall multiset& operator=(initializer_list<value_type> il); 2857a984708SDavid Chisnall 2867a984708SDavid Chisnall // iterators: 2877a984708SDavid Chisnall iterator begin() noexcept; 2887a984708SDavid Chisnall const_iterator begin() const noexcept; 2897a984708SDavid Chisnall iterator end() noexcept; 2907a984708SDavid Chisnall const_iterator end() const noexcept; 2917a984708SDavid Chisnall 2927a984708SDavid Chisnall reverse_iterator rbegin() noexcept; 2937a984708SDavid Chisnall const_reverse_iterator rbegin() const noexcept; 2947a984708SDavid Chisnall reverse_iterator rend() noexcept; 2957a984708SDavid Chisnall const_reverse_iterator rend() const noexcept; 2967a984708SDavid Chisnall 2977a984708SDavid Chisnall const_iterator cbegin() const noexcept; 2987a984708SDavid Chisnall const_iterator cend() const noexcept; 2997a984708SDavid Chisnall const_reverse_iterator crbegin() const noexcept; 3007a984708SDavid Chisnall const_reverse_iterator crend() const noexcept; 3017a984708SDavid Chisnall 3027a984708SDavid Chisnall // capacity: 3037a984708SDavid Chisnall bool empty() const noexcept; 3047a984708SDavid Chisnall size_type size() const noexcept; 3057a984708SDavid Chisnall size_type max_size() const noexcept; 3067a984708SDavid Chisnall 3077a984708SDavid Chisnall // modifiers: 3087a984708SDavid Chisnall template <class... Args> 3097a984708SDavid Chisnall iterator emplace(Args&&... args); 3107a984708SDavid Chisnall template <class... Args> 3117a984708SDavid Chisnall iterator emplace_hint(const_iterator position, Args&&... args); 3127a984708SDavid Chisnall iterator insert(const value_type& v); 3137a984708SDavid Chisnall iterator insert(value_type&& v); 3147a984708SDavid Chisnall iterator insert(const_iterator position, const value_type& v); 3157a984708SDavid Chisnall iterator insert(const_iterator position, value_type&& v); 3167a984708SDavid Chisnall template <class InputIterator> 3177a984708SDavid Chisnall void insert(InputIterator first, InputIterator last); 3187a984708SDavid Chisnall void insert(initializer_list<value_type> il); 3197a984708SDavid Chisnall 3204ba319b5SDimitry Andric node_type extract(const_iterator position); // C++17 3214ba319b5SDimitry Andric node_type extract(const key_type& x); // C++17 3224ba319b5SDimitry Andric iterator insert(node_type&& nh); // C++17 3234ba319b5SDimitry Andric iterator insert(const_iterator hint, node_type&& nh); // C++17 3244ba319b5SDimitry Andric 3257a984708SDavid Chisnall iterator erase(const_iterator position); 326854fa44bSDimitry Andric iterator erase(iterator position); // C++14 3277a984708SDavid Chisnall size_type erase(const key_type& k); 3287a984708SDavid Chisnall iterator erase(const_iterator first, const_iterator last); 3297a984708SDavid Chisnall void clear() noexcept; 3307a984708SDavid Chisnall 331*b5893f02SDimitry Andric template<class C2> 332*b5893f02SDimitry Andric void merge(multiset<Key, C2, Allocator>& source); // C++17 333*b5893f02SDimitry Andric template<class C2> 334*b5893f02SDimitry Andric void merge(multiset<Key, C2, Allocator>&& source); // C++17 335*b5893f02SDimitry Andric template<class C2> 336*b5893f02SDimitry Andric void merge(set<Key, C2, Allocator>& source); // C++17 337*b5893f02SDimitry Andric template<class C2> 338*b5893f02SDimitry Andric void merge(set<Key, C2, Allocator>&& source); // C++17 339*b5893f02SDimitry Andric 3407a984708SDavid Chisnall void swap(multiset& s) 3417a984708SDavid Chisnall noexcept( 3427a984708SDavid Chisnall __is_nothrow_swappable<key_compare>::value && 3437a984708SDavid Chisnall (!allocator_type::propagate_on_container_swap::value || 3447a984708SDavid Chisnall __is_nothrow_swappable<allocator_type>::value)); 3457a984708SDavid Chisnall 3467a984708SDavid Chisnall // observers: 3477a984708SDavid Chisnall allocator_type get_allocator() const noexcept; 3487a984708SDavid Chisnall key_compare key_comp() const; 3497a984708SDavid Chisnall value_compare value_comp() const; 3507a984708SDavid Chisnall 3517a984708SDavid Chisnall // set operations: 3527a984708SDavid Chisnall iterator find(const key_type& k); 3537a984708SDavid Chisnall const_iterator find(const key_type& k) const; 3544f7ab58eSDimitry Andric template<typename K> 3554f7ab58eSDimitry Andric iterator find(const K& x); 3564f7ab58eSDimitry Andric template<typename K> 3574f7ab58eSDimitry Andric const_iterator find(const K& x) const; // C++14 3584f7ab58eSDimitry Andric 3597a984708SDavid Chisnall size_type count(const key_type& k) const; 3607a984708SDavid Chisnall iterator lower_bound(const key_type& k); 3617a984708SDavid Chisnall const_iterator lower_bound(const key_type& k) const; 3624f7ab58eSDimitry Andric template<typename K> 3634f7ab58eSDimitry Andric iterator lower_bound(const K& x); // C++14 3644f7ab58eSDimitry Andric template<typename K> 3654f7ab58eSDimitry Andric const_iterator lower_bound(const K& x) const; // C++14 3664f7ab58eSDimitry Andric 3677a984708SDavid Chisnall iterator upper_bound(const key_type& k); 3687a984708SDavid Chisnall const_iterator upper_bound(const key_type& k) const; 3694f7ab58eSDimitry Andric template<typename K> 3704f7ab58eSDimitry Andric iterator upper_bound(const K& x); // C++14 3714f7ab58eSDimitry Andric template<typename K> 3724f7ab58eSDimitry Andric const_iterator upper_bound(const K& x) const; // C++14 3734f7ab58eSDimitry Andric 3747a984708SDavid Chisnall pair<iterator,iterator> equal_range(const key_type& k); 3757a984708SDavid Chisnall pair<const_iterator,const_iterator> equal_range(const key_type& k) const; 3764f7ab58eSDimitry Andric template<typename K> 3774f7ab58eSDimitry Andric pair<iterator,iterator> equal_range(const K& x); // C++14 3784f7ab58eSDimitry Andric template<typename K> 3794f7ab58eSDimitry Andric pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 3807a984708SDavid Chisnall}; 3817a984708SDavid Chisnall 3827a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 3837a984708SDavid Chisnallbool 3847a984708SDavid Chisnalloperator==(const multiset<Key, Compare, Allocator>& x, 3857a984708SDavid Chisnall const multiset<Key, Compare, Allocator>& y); 3867a984708SDavid Chisnall 3877a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 3887a984708SDavid Chisnallbool 3897a984708SDavid Chisnalloperator< (const multiset<Key, Compare, Allocator>& x, 3907a984708SDavid Chisnall const multiset<Key, Compare, Allocator>& y); 3917a984708SDavid Chisnall 3927a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 3937a984708SDavid Chisnallbool 3947a984708SDavid Chisnalloperator!=(const multiset<Key, Compare, Allocator>& x, 3957a984708SDavid Chisnall const multiset<Key, Compare, Allocator>& y); 3967a984708SDavid Chisnall 3977a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 3987a984708SDavid Chisnallbool 3997a984708SDavid Chisnalloperator> (const multiset<Key, Compare, Allocator>& x, 4007a984708SDavid Chisnall const multiset<Key, Compare, Allocator>& y); 4017a984708SDavid Chisnall 4027a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 4037a984708SDavid Chisnallbool 4047a984708SDavid Chisnalloperator>=(const multiset<Key, Compare, Allocator>& x, 4057a984708SDavid Chisnall const multiset<Key, Compare, Allocator>& y); 4067a984708SDavid Chisnall 4077a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 4087a984708SDavid Chisnallbool 4097a984708SDavid Chisnalloperator<=(const multiset<Key, Compare, Allocator>& x, 4107a984708SDavid Chisnall const multiset<Key, Compare, Allocator>& y); 4117a984708SDavid Chisnall 4127a984708SDavid Chisnall// specialized algorithms: 4137a984708SDavid Chisnalltemplate <class Key, class Compare, class Allocator> 4147a984708SDavid Chisnallvoid 4157a984708SDavid Chisnallswap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y) 4167a984708SDavid Chisnall noexcept(noexcept(x.swap(y))); 4177a984708SDavid Chisnall 418*b5893f02SDimitry Andrictemplate <class Key, class Compare, class Allocator, class Predicate> 419*b5893f02SDimitry Andric void erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 420*b5893f02SDimitry Andric 4217a984708SDavid Chisnall} // std 4227a984708SDavid Chisnall 4237a984708SDavid Chisnall*/ 4247a984708SDavid Chisnall 4257a984708SDavid Chisnall#include <__config> 4267a984708SDavid Chisnall#include <__tree> 4274ba319b5SDimitry Andric#include <__node_handle> 4287a984708SDavid Chisnall#include <functional> 429*b5893f02SDimitry Andric#include <version> 4307a984708SDavid Chisnall 4317a984708SDavid Chisnall#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 4327a984708SDavid Chisnall#pragma GCC system_header 4337a984708SDavid Chisnall#endif 4347a984708SDavid Chisnall 4357a984708SDavid Chisnall_LIBCPP_BEGIN_NAMESPACE_STD 4367a984708SDavid Chisnall 437*b5893f02SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 438*b5893f02SDimitry Andricclass multiset; 439*b5893f02SDimitry Andric 4407a984708SDavid Chisnalltemplate <class _Key, class _Compare = less<_Key>, 4417a984708SDavid Chisnall class _Allocator = allocator<_Key> > 442aed8d94eSDimitry Andricclass _LIBCPP_TEMPLATE_VIS set 4437a984708SDavid Chisnall{ 4447a984708SDavid Chisnallpublic: 4457a984708SDavid Chisnall // types: 4467a984708SDavid Chisnall typedef _Key key_type; 4477a984708SDavid Chisnall typedef key_type value_type; 4487a984708SDavid Chisnall typedef _Compare key_compare; 4497a984708SDavid Chisnall typedef key_compare value_compare; 4507a984708SDavid Chisnall typedef _Allocator allocator_type; 4517a984708SDavid Chisnall typedef value_type& reference; 4527a984708SDavid Chisnall typedef const value_type& const_reference; 4537a984708SDavid Chisnall 454*b5893f02SDimitry Andric static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); 4559729cf09SDimitry Andric static_assert((is_same<typename allocator_type::value_type, value_type>::value), 4569729cf09SDimitry Andric "Allocator::value_type must be same type as value_type"); 4579729cf09SDimitry Andric 4587a984708SDavid Chisnallprivate: 4597a984708SDavid Chisnall typedef __tree<value_type, value_compare, allocator_type> __base; 4607a984708SDavid Chisnall typedef allocator_traits<allocator_type> __alloc_traits; 4617a984708SDavid Chisnall typedef typename __base::__node_holder __node_holder; 4627a984708SDavid Chisnall 4637a984708SDavid Chisnall __base __tree_; 4647a984708SDavid Chisnall 4657a984708SDavid Chisnallpublic: 4667a984708SDavid Chisnall typedef typename __base::pointer pointer; 4677a984708SDavid Chisnall typedef typename __base::const_pointer const_pointer; 4687a984708SDavid Chisnall typedef typename __base::size_type size_type; 4697a984708SDavid Chisnall typedef typename __base::difference_type difference_type; 4707a984708SDavid Chisnall typedef typename __base::const_iterator iterator; 4717a984708SDavid Chisnall typedef typename __base::const_iterator const_iterator; 4727a984708SDavid Chisnall typedef _VSTD::reverse_iterator<iterator> reverse_iterator; 4737a984708SDavid Chisnall typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; 4747a984708SDavid Chisnall 4754ba319b5SDimitry Andric#if _LIBCPP_STD_VER > 14 4764ba319b5SDimitry Andric typedef __set_node_handle<typename __base::__node, allocator_type> node_type; 4774ba319b5SDimitry Andric typedef __insert_return_type<iterator, node_type> insert_return_type; 4784ba319b5SDimitry Andric#endif 4794ba319b5SDimitry Andric 480*b5893f02SDimitry Andric template <class _Key2, class _Compare2, class _Alloc2> 481*b5893f02SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS set; 482*b5893f02SDimitry Andric template <class _Key2, class _Compare2, class _Alloc2> 483*b5893f02SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS multiset; 484*b5893f02SDimitry Andric 4857a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 486d72607e9SDimitry Andric set() 4877a984708SDavid Chisnall _NOEXCEPT_( 4887a984708SDavid Chisnall is_nothrow_default_constructible<allocator_type>::value && 4897a984708SDavid Chisnall is_nothrow_default_constructible<key_compare>::value && 4907a984708SDavid Chisnall is_nothrow_copy_constructible<key_compare>::value) 491d72607e9SDimitry Andric : __tree_(value_compare()) {} 492d72607e9SDimitry Andric 4937a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 494d72607e9SDimitry Andric explicit set(const value_compare& __comp) 495d72607e9SDimitry Andric _NOEXCEPT_( 496d72607e9SDimitry Andric is_nothrow_default_constructible<allocator_type>::value && 497d72607e9SDimitry Andric is_nothrow_copy_constructible<key_compare>::value) 498d72607e9SDimitry Andric : __tree_(__comp) {} 499d72607e9SDimitry Andric 500d72607e9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 501d72607e9SDimitry Andric explicit set(const value_compare& __comp, const allocator_type& __a) 5027a984708SDavid Chisnall : __tree_(__comp, __a) {} 5037a984708SDavid Chisnall template <class _InputIterator> 5047a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5057a984708SDavid Chisnall set(_InputIterator __f, _InputIterator __l, 5067a984708SDavid Chisnall const value_compare& __comp = value_compare()) 5077a984708SDavid Chisnall : __tree_(__comp) 5087a984708SDavid Chisnall { 5097a984708SDavid Chisnall insert(__f, __l); 5107a984708SDavid Chisnall } 5117a984708SDavid Chisnall 5127a984708SDavid Chisnall template <class _InputIterator> 5137a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5147a984708SDavid Chisnall set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, 5157a984708SDavid Chisnall const allocator_type& __a) 5167a984708SDavid Chisnall : __tree_(__comp, __a) 5177a984708SDavid Chisnall { 5187a984708SDavid Chisnall insert(__f, __l); 5197a984708SDavid Chisnall } 5207a984708SDavid Chisnall 5214f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 5224f7ab58eSDimitry Andric template <class _InputIterator> 5234f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 5244f7ab58eSDimitry Andric set(_InputIterator __f, _InputIterator __l, const allocator_type& __a) 5254f7ab58eSDimitry Andric : set(__f, __l, key_compare(), __a) {} 5264f7ab58eSDimitry Andric#endif 5274f7ab58eSDimitry Andric 5287a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5297a984708SDavid Chisnall set(const set& __s) 5307a984708SDavid Chisnall : __tree_(__s.__tree_) 5317a984708SDavid Chisnall { 5327a984708SDavid Chisnall insert(__s.begin(), __s.end()); 5337a984708SDavid Chisnall } 5347a984708SDavid Chisnall 5357a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5367a984708SDavid Chisnall set& operator=(const set& __s) 5377a984708SDavid Chisnall { 5387a984708SDavid Chisnall __tree_ = __s.__tree_; 5397a984708SDavid Chisnall return *this; 5407a984708SDavid Chisnall } 5417a984708SDavid Chisnall 542540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 5437a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5447a984708SDavid Chisnall set(set&& __s) 5457a984708SDavid Chisnall _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) 5467a984708SDavid Chisnall : __tree_(_VSTD::move(__s.__tree_)) {} 547540d2a8bSDimitry Andric#endif // _LIBCPP_CXX03_LANG 5487a984708SDavid Chisnall 5497a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5507a984708SDavid Chisnall explicit set(const allocator_type& __a) 5517a984708SDavid Chisnall : __tree_(__a) {} 5527a984708SDavid Chisnall 5537a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5547a984708SDavid Chisnall set(const set& __s, const allocator_type& __a) 5557a984708SDavid Chisnall : __tree_(__s.__tree_.value_comp(), __a) 5567a984708SDavid Chisnall { 5577a984708SDavid Chisnall insert(__s.begin(), __s.end()); 5587a984708SDavid Chisnall } 5597a984708SDavid Chisnall 560540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 5617a984708SDavid Chisnall set(set&& __s, const allocator_type& __a); 5627a984708SDavid Chisnall 5637a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5647a984708SDavid Chisnall set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) 5657a984708SDavid Chisnall : __tree_(__comp) 5667a984708SDavid Chisnall { 5677a984708SDavid Chisnall insert(__il.begin(), __il.end()); 5687a984708SDavid Chisnall } 5697a984708SDavid Chisnall 5707a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5717a984708SDavid Chisnall set(initializer_list<value_type> __il, const value_compare& __comp, 5727a984708SDavid Chisnall const allocator_type& __a) 5737a984708SDavid Chisnall : __tree_(__comp, __a) 5747a984708SDavid Chisnall { 5757a984708SDavid Chisnall insert(__il.begin(), __il.end()); 5767a984708SDavid Chisnall } 5777a984708SDavid Chisnall 5784f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 5794f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 5804f7ab58eSDimitry Andric set(initializer_list<value_type> __il, const allocator_type& __a) 5814f7ab58eSDimitry Andric : set(__il, key_compare(), __a) {} 5824f7ab58eSDimitry Andric#endif 5834f7ab58eSDimitry Andric 5847a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5857a984708SDavid Chisnall set& operator=(initializer_list<value_type> __il) 5867a984708SDavid Chisnall { 5877a984708SDavid Chisnall __tree_.__assign_unique(__il.begin(), __il.end()); 5887a984708SDavid Chisnall return *this; 5897a984708SDavid Chisnall } 5907a984708SDavid Chisnall 5917a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 5927a984708SDavid Chisnall set& operator=(set&& __s) 5937a984708SDavid Chisnall _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) 5947a984708SDavid Chisnall { 5957a984708SDavid Chisnall __tree_ = _VSTD::move(__s.__tree_); 5967a984708SDavid Chisnall return *this; 5977a984708SDavid Chisnall } 598540d2a8bSDimitry Andric#endif // _LIBCPP_CXX03_LANG 5997a984708SDavid Chisnall 6007a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6017a984708SDavid Chisnall iterator begin() _NOEXCEPT {return __tree_.begin();} 6027a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6037a984708SDavid Chisnall const_iterator begin() const _NOEXCEPT {return __tree_.begin();} 6047a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6057a984708SDavid Chisnall iterator end() _NOEXCEPT {return __tree_.end();} 6067a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6077a984708SDavid Chisnall const_iterator end() const _NOEXCEPT {return __tree_.end();} 6087a984708SDavid Chisnall 6097a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6107a984708SDavid Chisnall reverse_iterator rbegin() _NOEXCEPT 6117a984708SDavid Chisnall {return reverse_iterator(end());} 6127a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6137a984708SDavid Chisnall const_reverse_iterator rbegin() const _NOEXCEPT 6147a984708SDavid Chisnall {return const_reverse_iterator(end());} 6157a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6167a984708SDavid Chisnall reverse_iterator rend() _NOEXCEPT 6177a984708SDavid Chisnall {return reverse_iterator(begin());} 6187a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6197a984708SDavid Chisnall const_reverse_iterator rend() const _NOEXCEPT 6207a984708SDavid Chisnall {return const_reverse_iterator(begin());} 6217a984708SDavid Chisnall 6227a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6237a984708SDavid Chisnall const_iterator cbegin() const _NOEXCEPT {return begin();} 6247a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6257a984708SDavid Chisnall const_iterator cend() const _NOEXCEPT {return end();} 6267a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6277a984708SDavid Chisnall const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} 6287a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6297a984708SDavid Chisnall const_reverse_iterator crend() const _NOEXCEPT {return rend();} 6307a984708SDavid Chisnall 631b2c7081bSDimitry Andric _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 6327a984708SDavid Chisnall bool empty() const _NOEXCEPT {return __tree_.size() == 0;} 6337a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6347a984708SDavid Chisnall size_type size() const _NOEXCEPT {return __tree_.size();} 6357a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6367a984708SDavid Chisnall size_type max_size() const _NOEXCEPT {return __tree_.max_size();} 6377a984708SDavid Chisnall 6387a984708SDavid Chisnall // modifiers: 639540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 6407a984708SDavid Chisnall template <class... _Args> 6417a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6427a984708SDavid Chisnall pair<iterator, bool> emplace(_Args&&... __args) 6437a984708SDavid Chisnall {return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} 6447a984708SDavid Chisnall template <class... _Args> 6457a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6467a984708SDavid Chisnall iterator emplace_hint(const_iterator __p, _Args&&... __args) 6477a984708SDavid Chisnall {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);} 648540d2a8bSDimitry Andric#endif // _LIBCPP_CXX03_LANG 649540d2a8bSDimitry Andric 6507a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6517a984708SDavid Chisnall pair<iterator,bool> insert(const value_type& __v) 6527a984708SDavid Chisnall {return __tree_.__insert_unique(__v);} 6537a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6547a984708SDavid Chisnall iterator insert(const_iterator __p, const value_type& __v) 6557a984708SDavid Chisnall {return __tree_.__insert_unique(__p, __v);} 656540d2a8bSDimitry Andric 6577a984708SDavid Chisnall template <class _InputIterator> 6587a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6597a984708SDavid Chisnall void insert(_InputIterator __f, _InputIterator __l) 6607a984708SDavid Chisnall { 6617a984708SDavid Chisnall for (const_iterator __e = cend(); __f != __l; ++__f) 6627a984708SDavid Chisnall __tree_.__insert_unique(__e, *__f); 6637a984708SDavid Chisnall } 6647a984708SDavid Chisnall 665540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 666540d2a8bSDimitry Andric _LIBCPP_INLINE_VISIBILITY 667540d2a8bSDimitry Andric pair<iterator,bool> insert(value_type&& __v) 668540d2a8bSDimitry Andric {return __tree_.__insert_unique(_VSTD::move(__v));} 669540d2a8bSDimitry Andric 670540d2a8bSDimitry Andric _LIBCPP_INLINE_VISIBILITY 671540d2a8bSDimitry Andric iterator insert(const_iterator __p, value_type&& __v) 672540d2a8bSDimitry Andric {return __tree_.__insert_unique(__p, _VSTD::move(__v));} 673540d2a8bSDimitry Andric 6747a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6757a984708SDavid Chisnall void insert(initializer_list<value_type> __il) 6767a984708SDavid Chisnall {insert(__il.begin(), __il.end());} 677540d2a8bSDimitry Andric#endif // _LIBCPP_CXX03_LANG 6787a984708SDavid Chisnall 6797a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6807a984708SDavid Chisnall iterator erase(const_iterator __p) {return __tree_.erase(__p);} 6817a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6827a984708SDavid Chisnall size_type erase(const key_type& __k) 6837a984708SDavid Chisnall {return __tree_.__erase_unique(__k);} 6847a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6857a984708SDavid Chisnall iterator erase(const_iterator __f, const_iterator __l) 6867a984708SDavid Chisnall {return __tree_.erase(__f, __l);} 6877a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 6887a984708SDavid Chisnall void clear() _NOEXCEPT {__tree_.clear();} 6897a984708SDavid Chisnall 6904ba319b5SDimitry Andric#if _LIBCPP_STD_VER > 14 6914ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6924ba319b5SDimitry Andric insert_return_type insert(node_type&& __nh) 6934ba319b5SDimitry Andric { 6944ba319b5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 6954ba319b5SDimitry Andric "node_type with incompatible allocator passed to set::insert()"); 6964ba319b5SDimitry Andric return __tree_.template __node_handle_insert_unique< 6974ba319b5SDimitry Andric node_type, insert_return_type>(_VSTD::move(__nh)); 6984ba319b5SDimitry Andric } 6994ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7004ba319b5SDimitry Andric iterator insert(const_iterator __hint, node_type&& __nh) 7014ba319b5SDimitry Andric { 7024ba319b5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 7034ba319b5SDimitry Andric "node_type with incompatible allocator passed to set::insert()"); 7044ba319b5SDimitry Andric return __tree_.template __node_handle_insert_unique<node_type>( 7054ba319b5SDimitry Andric __hint, _VSTD::move(__nh)); 7064ba319b5SDimitry Andric } 7074ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7084ba319b5SDimitry Andric node_type extract(key_type const& __key) 7094ba319b5SDimitry Andric { 7104ba319b5SDimitry Andric return __tree_.template __node_handle_extract<node_type>(__key); 7114ba319b5SDimitry Andric } 7124ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7134ba319b5SDimitry Andric node_type extract(const_iterator __it) 7144ba319b5SDimitry Andric { 7154ba319b5SDimitry Andric return __tree_.template __node_handle_extract<node_type>(__it); 7164ba319b5SDimitry Andric } 717*b5893f02SDimitry Andric template <class _Compare2> 718*b5893f02SDimitry Andric _LIBCPP_INLINE_VISIBILITY 719*b5893f02SDimitry Andric void merge(set<key_type, _Compare2, allocator_type>& __source) 720*b5893f02SDimitry Andric { 721*b5893f02SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 722*b5893f02SDimitry Andric "merging container with incompatible allocator"); 723*b5893f02SDimitry Andric __tree_.__node_handle_merge_unique(__source.__tree_); 724*b5893f02SDimitry Andric } 725*b5893f02SDimitry Andric template <class _Compare2> 726*b5893f02SDimitry Andric _LIBCPP_INLINE_VISIBILITY 727*b5893f02SDimitry Andric void merge(set<key_type, _Compare2, allocator_type>&& __source) 728*b5893f02SDimitry Andric { 729*b5893f02SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 730*b5893f02SDimitry Andric "merging container with incompatible allocator"); 731*b5893f02SDimitry Andric __tree_.__node_handle_merge_unique(__source.__tree_); 732*b5893f02SDimitry Andric } 733*b5893f02SDimitry Andric template <class _Compare2> 734*b5893f02SDimitry Andric _LIBCPP_INLINE_VISIBILITY 735*b5893f02SDimitry Andric void merge(multiset<key_type, _Compare2, allocator_type>& __source) 736*b5893f02SDimitry Andric { 737*b5893f02SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 738*b5893f02SDimitry Andric "merging container with incompatible allocator"); 739*b5893f02SDimitry Andric __tree_.__node_handle_merge_unique(__source.__tree_); 740*b5893f02SDimitry Andric } 741*b5893f02SDimitry Andric template <class _Compare2> 742*b5893f02SDimitry Andric _LIBCPP_INLINE_VISIBILITY 743*b5893f02SDimitry Andric void merge(multiset<key_type, _Compare2, allocator_type>&& __source) 744*b5893f02SDimitry Andric { 745*b5893f02SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 746*b5893f02SDimitry Andric "merging container with incompatible allocator"); 747*b5893f02SDimitry Andric __tree_.__node_handle_merge_unique(__source.__tree_); 748*b5893f02SDimitry Andric } 7494ba319b5SDimitry Andric#endif 7504ba319b5SDimitry Andric 7517a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 7527a984708SDavid Chisnall void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) 7537a984708SDavid Chisnall {__tree_.swap(__s.__tree_);} 7547a984708SDavid Chisnall 7557a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 7567a984708SDavid Chisnall allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();} 7577a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 7587a984708SDavid Chisnall key_compare key_comp() const {return __tree_.value_comp();} 7597a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 7607a984708SDavid Chisnall value_compare value_comp() const {return __tree_.value_comp();} 7617a984708SDavid Chisnall 7627a984708SDavid Chisnall // set operations: 7637a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 7647a984708SDavid Chisnall iterator find(const key_type& __k) {return __tree_.find(__k);} 7657a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 7667a984708SDavid Chisnall const_iterator find(const key_type& __k) const {return __tree_.find(__k);} 7674f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 7684f7ab58eSDimitry Andric template <typename _K2> 7694f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 7704f7ab58eSDimitry Andric typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type 7714f7ab58eSDimitry Andric find(const _K2& __k) {return __tree_.find(__k);} 7724f7ab58eSDimitry Andric template <typename _K2> 7734f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 7744f7ab58eSDimitry Andric typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type 7754f7ab58eSDimitry Andric find(const _K2& __k) const {return __tree_.find(__k);} 7764f7ab58eSDimitry Andric#endif 7774f7ab58eSDimitry Andric 7787a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 7797a984708SDavid Chisnall size_type count(const key_type& __k) const 7807a984708SDavid Chisnall {return __tree_.__count_unique(__k);} 781d72607e9SDimitry Andric#if _LIBCPP_STD_VER > 11 782d72607e9SDimitry Andric template <typename _K2> 783d72607e9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 784d72607e9SDimitry Andric typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type 7854ba319b5SDimitry Andric count(const _K2& __k) const {return __tree_.__count_multi(__k);} 786d72607e9SDimitry Andric#endif 7877a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 7887a984708SDavid Chisnall iterator lower_bound(const key_type& __k) 7897a984708SDavid Chisnall {return __tree_.lower_bound(__k);} 7907a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 7917a984708SDavid Chisnall const_iterator lower_bound(const key_type& __k) const 7927a984708SDavid Chisnall {return __tree_.lower_bound(__k);} 7934f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 7944f7ab58eSDimitry Andric template <typename _K2> 7954f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 7964f7ab58eSDimitry Andric typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type 7974f7ab58eSDimitry Andric lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} 7984f7ab58eSDimitry Andric 7994f7ab58eSDimitry Andric template <typename _K2> 8004f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 8014f7ab58eSDimitry Andric typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type 8024f7ab58eSDimitry Andric lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} 8034f7ab58eSDimitry Andric#endif 8044f7ab58eSDimitry Andric 8057a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 8067a984708SDavid Chisnall iterator upper_bound(const key_type& __k) 8077a984708SDavid Chisnall {return __tree_.upper_bound(__k);} 8087a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 8097a984708SDavid Chisnall const_iterator upper_bound(const key_type& __k) const 8107a984708SDavid Chisnall {return __tree_.upper_bound(__k);} 8114f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 8124f7ab58eSDimitry Andric template <typename _K2> 8134f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 8144f7ab58eSDimitry Andric typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type 8154f7ab58eSDimitry Andric upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} 8164f7ab58eSDimitry Andric template <typename _K2> 8174f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 8184f7ab58eSDimitry Andric typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type 8194f7ab58eSDimitry Andric upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} 8204f7ab58eSDimitry Andric#endif 8214f7ab58eSDimitry Andric 8227a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 8237a984708SDavid Chisnall pair<iterator,iterator> equal_range(const key_type& __k) 8247a984708SDavid Chisnall {return __tree_.__equal_range_unique(__k);} 8257a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 8267a984708SDavid Chisnall pair<const_iterator,const_iterator> equal_range(const key_type& __k) const 8277a984708SDavid Chisnall {return __tree_.__equal_range_unique(__k);} 8284f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 8294f7ab58eSDimitry Andric template <typename _K2> 8304f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 8314f7ab58eSDimitry Andric typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type 8324ba319b5SDimitry Andric equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} 8334f7ab58eSDimitry Andric template <typename _K2> 8344f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 8354f7ab58eSDimitry Andric typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type 8364ba319b5SDimitry Andric equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} 8374f7ab58eSDimitry Andric#endif 8387a984708SDavid Chisnall}; 8397a984708SDavid Chisnall 840540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 8417a984708SDavid Chisnall 8427a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 8437a984708SDavid Chisnallset<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) 8447a984708SDavid Chisnall : __tree_(_VSTD::move(__s.__tree_), __a) 8457a984708SDavid Chisnall{ 8467a984708SDavid Chisnall if (__a != __s.get_allocator()) 8477a984708SDavid Chisnall { 8487a984708SDavid Chisnall const_iterator __e = cend(); 8497a984708SDavid Chisnall while (!__s.empty()) 8507a984708SDavid Chisnall insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_)); 8517a984708SDavid Chisnall } 8527a984708SDavid Chisnall} 8537a984708SDavid Chisnall 854540d2a8bSDimitry Andric#endif // _LIBCPP_CXX03_LANG 8557a984708SDavid Chisnall 8567a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 8577a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 8587a984708SDavid Chisnallbool 8597a984708SDavid Chisnalloperator==(const set<_Key, _Compare, _Allocator>& __x, 8607a984708SDavid Chisnall const set<_Key, _Compare, _Allocator>& __y) 8617a984708SDavid Chisnall{ 8627a984708SDavid Chisnall return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); 8637a984708SDavid Chisnall} 8647a984708SDavid Chisnall 8657a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 8667a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 8677a984708SDavid Chisnallbool 8687a984708SDavid Chisnalloperator< (const set<_Key, _Compare, _Allocator>& __x, 8697a984708SDavid Chisnall const set<_Key, _Compare, _Allocator>& __y) 8707a984708SDavid Chisnall{ 8717a984708SDavid Chisnall return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); 8727a984708SDavid Chisnall} 8737a984708SDavid Chisnall 8747a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 8757a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 8767a984708SDavid Chisnallbool 8777a984708SDavid Chisnalloperator!=(const set<_Key, _Compare, _Allocator>& __x, 8787a984708SDavid Chisnall const set<_Key, _Compare, _Allocator>& __y) 8797a984708SDavid Chisnall{ 8807a984708SDavid Chisnall return !(__x == __y); 8817a984708SDavid Chisnall} 8827a984708SDavid Chisnall 8837a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 8847a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 8857a984708SDavid Chisnallbool 8867a984708SDavid Chisnalloperator> (const set<_Key, _Compare, _Allocator>& __x, 8877a984708SDavid Chisnall const set<_Key, _Compare, _Allocator>& __y) 8887a984708SDavid Chisnall{ 8897a984708SDavid Chisnall return __y < __x; 8907a984708SDavid Chisnall} 8917a984708SDavid Chisnall 8927a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 8937a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 8947a984708SDavid Chisnallbool 8957a984708SDavid Chisnalloperator>=(const set<_Key, _Compare, _Allocator>& __x, 8967a984708SDavid Chisnall const set<_Key, _Compare, _Allocator>& __y) 8977a984708SDavid Chisnall{ 8987a984708SDavid Chisnall return !(__x < __y); 8997a984708SDavid Chisnall} 9007a984708SDavid Chisnall 9017a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 9027a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 9037a984708SDavid Chisnallbool 9047a984708SDavid Chisnalloperator<=(const set<_Key, _Compare, _Allocator>& __x, 9057a984708SDavid Chisnall const set<_Key, _Compare, _Allocator>& __y) 9067a984708SDavid Chisnall{ 9077a984708SDavid Chisnall return !(__y < __x); 9087a984708SDavid Chisnall} 9097a984708SDavid Chisnall 9107a984708SDavid Chisnall// specialized algorithms: 9117a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 9127a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 9137a984708SDavid Chisnallvoid 9147a984708SDavid Chisnallswap(set<_Key, _Compare, _Allocator>& __x, 9157a984708SDavid Chisnall set<_Key, _Compare, _Allocator>& __y) 9167a984708SDavid Chisnall _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 9177a984708SDavid Chisnall{ 9187a984708SDavid Chisnall __x.swap(__y); 9197a984708SDavid Chisnall} 9207a984708SDavid Chisnall 921*b5893f02SDimitry Andric#if _LIBCPP_STD_VER > 17 922*b5893f02SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator, class _Predicate> 923*b5893f02SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 924*b5893f02SDimitry Andricvoid erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) 925*b5893f02SDimitry Andric{ __libcpp_erase_if_container(__c, __pred); } 926*b5893f02SDimitry Andric#endif 927*b5893f02SDimitry Andric 9287a984708SDavid Chisnalltemplate <class _Key, class _Compare = less<_Key>, 9297a984708SDavid Chisnall class _Allocator = allocator<_Key> > 930aed8d94eSDimitry Andricclass _LIBCPP_TEMPLATE_VIS multiset 9317a984708SDavid Chisnall{ 9327a984708SDavid Chisnallpublic: 9337a984708SDavid Chisnall // types: 9347a984708SDavid Chisnall typedef _Key key_type; 9357a984708SDavid Chisnall typedef key_type value_type; 9367a984708SDavid Chisnall typedef _Compare key_compare; 9377a984708SDavid Chisnall typedef key_compare value_compare; 9387a984708SDavid Chisnall typedef _Allocator allocator_type; 9397a984708SDavid Chisnall typedef value_type& reference; 9407a984708SDavid Chisnall typedef const value_type& const_reference; 9417a984708SDavid Chisnall 942*b5893f02SDimitry Andric static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); 9439729cf09SDimitry Andric static_assert((is_same<typename allocator_type::value_type, value_type>::value), 9449729cf09SDimitry Andric "Allocator::value_type must be same type as value_type"); 9459729cf09SDimitry Andric 9467a984708SDavid Chisnallprivate: 9477a984708SDavid Chisnall typedef __tree<value_type, value_compare, allocator_type> __base; 9487a984708SDavid Chisnall typedef allocator_traits<allocator_type> __alloc_traits; 9497a984708SDavid Chisnall typedef typename __base::__node_holder __node_holder; 9507a984708SDavid Chisnall 9517a984708SDavid Chisnall __base __tree_; 9527a984708SDavid Chisnall 9537a984708SDavid Chisnallpublic: 9547a984708SDavid Chisnall typedef typename __base::pointer pointer; 9557a984708SDavid Chisnall typedef typename __base::const_pointer const_pointer; 9567a984708SDavid Chisnall typedef typename __base::size_type size_type; 9577a984708SDavid Chisnall typedef typename __base::difference_type difference_type; 9587a984708SDavid Chisnall typedef typename __base::const_iterator iterator; 9597a984708SDavid Chisnall typedef typename __base::const_iterator const_iterator; 9607a984708SDavid Chisnall typedef _VSTD::reverse_iterator<iterator> reverse_iterator; 9617a984708SDavid Chisnall typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; 9627a984708SDavid Chisnall 9634ba319b5SDimitry Andric#if _LIBCPP_STD_VER > 14 9644ba319b5SDimitry Andric typedef __set_node_handle<typename __base::__node, allocator_type> node_type; 9654ba319b5SDimitry Andric#endif 9664ba319b5SDimitry Andric 967*b5893f02SDimitry Andric template <class _Key2, class _Compare2, class _Alloc2> 968*b5893f02SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS set; 969*b5893f02SDimitry Andric template <class _Key2, class _Compare2, class _Alloc2> 970*b5893f02SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS multiset; 971*b5893f02SDimitry Andric 9727a984708SDavid Chisnall // construct/copy/destroy: 9737a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 974d72607e9SDimitry Andric multiset() 9757a984708SDavid Chisnall _NOEXCEPT_( 9767a984708SDavid Chisnall is_nothrow_default_constructible<allocator_type>::value && 9777a984708SDavid Chisnall is_nothrow_default_constructible<key_compare>::value && 9787a984708SDavid Chisnall is_nothrow_copy_constructible<key_compare>::value) 979d72607e9SDimitry Andric : __tree_(value_compare()) {} 980d72607e9SDimitry Andric 9817a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 982d72607e9SDimitry Andric explicit multiset(const value_compare& __comp) 983d72607e9SDimitry Andric _NOEXCEPT_( 984d72607e9SDimitry Andric is_nothrow_default_constructible<allocator_type>::value && 985d72607e9SDimitry Andric is_nothrow_copy_constructible<key_compare>::value) 986d72607e9SDimitry Andric : __tree_(__comp) {} 987d72607e9SDimitry Andric 988d72607e9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 989d72607e9SDimitry Andric explicit multiset(const value_compare& __comp, const allocator_type& __a) 9907a984708SDavid Chisnall : __tree_(__comp, __a) {} 9917a984708SDavid Chisnall template <class _InputIterator> 9927a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 9937a984708SDavid Chisnall multiset(_InputIterator __f, _InputIterator __l, 9947a984708SDavid Chisnall const value_compare& __comp = value_compare()) 9957a984708SDavid Chisnall : __tree_(__comp) 9967a984708SDavid Chisnall { 9977a984708SDavid Chisnall insert(__f, __l); 9987a984708SDavid Chisnall } 9997a984708SDavid Chisnall 10004f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 10014f7ab58eSDimitry Andric template <class _InputIterator> 10024f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 10034f7ab58eSDimitry Andric multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a) 10044f7ab58eSDimitry Andric : multiset(__f, __l, key_compare(), __a) {} 10054f7ab58eSDimitry Andric#endif 10064f7ab58eSDimitry Andric 10077a984708SDavid Chisnall template <class _InputIterator> 10087a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10097a984708SDavid Chisnall multiset(_InputIterator __f, _InputIterator __l, 10107a984708SDavid Chisnall const value_compare& __comp, const allocator_type& __a) 10117a984708SDavid Chisnall : __tree_(__comp, __a) 10127a984708SDavid Chisnall { 10137a984708SDavid Chisnall insert(__f, __l); 10147a984708SDavid Chisnall } 10157a984708SDavid Chisnall 10167a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10177a984708SDavid Chisnall multiset(const multiset& __s) 10187a984708SDavid Chisnall : __tree_(__s.__tree_.value_comp(), 10197a984708SDavid Chisnall __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc())) 10207a984708SDavid Chisnall { 10217a984708SDavid Chisnall insert(__s.begin(), __s.end()); 10227a984708SDavid Chisnall } 10237a984708SDavid Chisnall 10247a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10257a984708SDavid Chisnall multiset& operator=(const multiset& __s) 10267a984708SDavid Chisnall { 10277a984708SDavid Chisnall __tree_ = __s.__tree_; 10287a984708SDavid Chisnall return *this; 10297a984708SDavid Chisnall } 10307a984708SDavid Chisnall 1031540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 10327a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10337a984708SDavid Chisnall multiset(multiset&& __s) 10347a984708SDavid Chisnall _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) 10357a984708SDavid Chisnall : __tree_(_VSTD::move(__s.__tree_)) {} 1036540d2a8bSDimitry Andric 1037540d2a8bSDimitry Andric multiset(multiset&& __s, const allocator_type& __a); 1038540d2a8bSDimitry Andric#endif // _LIBCPP_CXX03_LANG 10397a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10407a984708SDavid Chisnall explicit multiset(const allocator_type& __a) 10417a984708SDavid Chisnall : __tree_(__a) {} 10427a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10437a984708SDavid Chisnall multiset(const multiset& __s, const allocator_type& __a) 10447a984708SDavid Chisnall : __tree_(__s.__tree_.value_comp(), __a) 10457a984708SDavid Chisnall { 10467a984708SDavid Chisnall insert(__s.begin(), __s.end()); 10477a984708SDavid Chisnall } 10487a984708SDavid Chisnall 1049540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 10507a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10517a984708SDavid Chisnall multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) 10527a984708SDavid Chisnall : __tree_(__comp) 10537a984708SDavid Chisnall { 10547a984708SDavid Chisnall insert(__il.begin(), __il.end()); 10557a984708SDavid Chisnall } 10567a984708SDavid Chisnall 10577a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10587a984708SDavid Chisnall multiset(initializer_list<value_type> __il, const value_compare& __comp, 10597a984708SDavid Chisnall const allocator_type& __a) 10607a984708SDavid Chisnall : __tree_(__comp, __a) 10617a984708SDavid Chisnall { 10627a984708SDavid Chisnall insert(__il.begin(), __il.end()); 10637a984708SDavid Chisnall } 10647a984708SDavid Chisnall 10654f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 10664f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 10674f7ab58eSDimitry Andric multiset(initializer_list<value_type> __il, const allocator_type& __a) 10684f7ab58eSDimitry Andric : multiset(__il, key_compare(), __a) {} 10694f7ab58eSDimitry Andric#endif 10704f7ab58eSDimitry Andric 10717a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10727a984708SDavid Chisnall multiset& operator=(initializer_list<value_type> __il) 10737a984708SDavid Chisnall { 10747a984708SDavid Chisnall __tree_.__assign_multi(__il.begin(), __il.end()); 10757a984708SDavid Chisnall return *this; 10767a984708SDavid Chisnall } 10777a984708SDavid Chisnall 10787a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10797a984708SDavid Chisnall multiset& operator=(multiset&& __s) 10807a984708SDavid Chisnall _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) 10817a984708SDavid Chisnall { 10827a984708SDavid Chisnall __tree_ = _VSTD::move(__s.__tree_); 10837a984708SDavid Chisnall return *this; 10847a984708SDavid Chisnall } 1085540d2a8bSDimitry Andric#endif // _LIBCPP_CXX03_LANG 10867a984708SDavid Chisnall 10877a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10887a984708SDavid Chisnall iterator begin() _NOEXCEPT {return __tree_.begin();} 10897a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10907a984708SDavid Chisnall const_iterator begin() const _NOEXCEPT {return __tree_.begin();} 10917a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10927a984708SDavid Chisnall iterator end() _NOEXCEPT {return __tree_.end();} 10937a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10947a984708SDavid Chisnall const_iterator end() const _NOEXCEPT {return __tree_.end();} 10957a984708SDavid Chisnall 10967a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 10977a984708SDavid Chisnall reverse_iterator rbegin() _NOEXCEPT 10987a984708SDavid Chisnall {return reverse_iterator(end());} 10997a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11007a984708SDavid Chisnall const_reverse_iterator rbegin() const _NOEXCEPT 11017a984708SDavid Chisnall {return const_reverse_iterator(end());} 11027a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11037a984708SDavid Chisnall reverse_iterator rend() _NOEXCEPT 11047a984708SDavid Chisnall {return reverse_iterator(begin());} 11057a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11067a984708SDavid Chisnall const_reverse_iterator rend() const _NOEXCEPT 11077a984708SDavid Chisnall {return const_reverse_iterator(begin());} 11087a984708SDavid Chisnall 11097a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11107a984708SDavid Chisnall const_iterator cbegin() const _NOEXCEPT {return begin();} 11117a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11127a984708SDavid Chisnall const_iterator cend() const _NOEXCEPT {return end();} 11137a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11147a984708SDavid Chisnall const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} 11157a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11167a984708SDavid Chisnall const_reverse_iterator crend() const _NOEXCEPT {return rend();} 11177a984708SDavid Chisnall 1118b2c7081bSDimitry Andric _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 11197a984708SDavid Chisnall bool empty() const _NOEXCEPT {return __tree_.size() == 0;} 11207a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11217a984708SDavid Chisnall size_type size() const _NOEXCEPT {return __tree_.size();} 11227a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11237a984708SDavid Chisnall size_type max_size() const _NOEXCEPT {return __tree_.max_size();} 11247a984708SDavid Chisnall 11257a984708SDavid Chisnall // modifiers: 1126540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 11277a984708SDavid Chisnall template <class... _Args> 11287a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11297a984708SDavid Chisnall iterator emplace(_Args&&... __args) 11307a984708SDavid Chisnall {return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);} 11317a984708SDavid Chisnall template <class... _Args> 11327a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11337a984708SDavid Chisnall iterator emplace_hint(const_iterator __p, _Args&&... __args) 11347a984708SDavid Chisnall {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} 1135540d2a8bSDimitry Andric#endif // _LIBCPP_CXX03_LANG 1136540d2a8bSDimitry Andric 11377a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11387a984708SDavid Chisnall iterator insert(const value_type& __v) 11397a984708SDavid Chisnall {return __tree_.__insert_multi(__v);} 11407a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11417a984708SDavid Chisnall iterator insert(const_iterator __p, const value_type& __v) 11427a984708SDavid Chisnall {return __tree_.__insert_multi(__p, __v);} 1143540d2a8bSDimitry Andric 11447a984708SDavid Chisnall template <class _InputIterator> 11457a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11467a984708SDavid Chisnall void insert(_InputIterator __f, _InputIterator __l) 11477a984708SDavid Chisnall { 11487a984708SDavid Chisnall for (const_iterator __e = cend(); __f != __l; ++__f) 11497a984708SDavid Chisnall __tree_.__insert_multi(__e, *__f); 11507a984708SDavid Chisnall } 11517a984708SDavid Chisnall 1152540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 1153540d2a8bSDimitry Andric _LIBCPP_INLINE_VISIBILITY 1154540d2a8bSDimitry Andric iterator insert(value_type&& __v) 1155540d2a8bSDimitry Andric {return __tree_.__insert_multi(_VSTD::move(__v));} 1156540d2a8bSDimitry Andric 1157540d2a8bSDimitry Andric _LIBCPP_INLINE_VISIBILITY 1158540d2a8bSDimitry Andric iterator insert(const_iterator __p, value_type&& __v) 1159540d2a8bSDimitry Andric {return __tree_.__insert_multi(__p, _VSTD::move(__v));} 1160540d2a8bSDimitry Andric 11617a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11627a984708SDavid Chisnall void insert(initializer_list<value_type> __il) 11637a984708SDavid Chisnall {insert(__il.begin(), __il.end());} 1164540d2a8bSDimitry Andric#endif // _LIBCPP_CXX03_LANG 11657a984708SDavid Chisnall 11667a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11677a984708SDavid Chisnall iterator erase(const_iterator __p) {return __tree_.erase(__p);} 11687a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11697a984708SDavid Chisnall size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);} 11707a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11717a984708SDavid Chisnall iterator erase(const_iterator __f, const_iterator __l) 11727a984708SDavid Chisnall {return __tree_.erase(__f, __l);} 11737a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 11747a984708SDavid Chisnall void clear() _NOEXCEPT {__tree_.clear();} 11757a984708SDavid Chisnall 11764ba319b5SDimitry Andric#if _LIBCPP_STD_VER > 14 11774ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 11784ba319b5SDimitry Andric iterator insert(node_type&& __nh) 11794ba319b5SDimitry Andric { 11804ba319b5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 11814ba319b5SDimitry Andric "node_type with incompatible allocator passed to multiset::insert()"); 11824ba319b5SDimitry Andric return __tree_.template __node_handle_insert_multi<node_type>( 11834ba319b5SDimitry Andric _VSTD::move(__nh)); 11844ba319b5SDimitry Andric } 11854ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 11864ba319b5SDimitry Andric iterator insert(const_iterator __hint, node_type&& __nh) 11874ba319b5SDimitry Andric { 11884ba319b5SDimitry Andric _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), 11894ba319b5SDimitry Andric "node_type with incompatible allocator passed to multiset::insert()"); 11904ba319b5SDimitry Andric return __tree_.template __node_handle_insert_multi<node_type>( 11914ba319b5SDimitry Andric __hint, _VSTD::move(__nh)); 11924ba319b5SDimitry Andric } 11934ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 11944ba319b5SDimitry Andric node_type extract(key_type const& __key) 11954ba319b5SDimitry Andric { 11964ba319b5SDimitry Andric return __tree_.template __node_handle_extract<node_type>(__key); 11974ba319b5SDimitry Andric } 11984ba319b5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 11994ba319b5SDimitry Andric node_type extract(const_iterator __it) 12004ba319b5SDimitry Andric { 12014ba319b5SDimitry Andric return __tree_.template __node_handle_extract<node_type>(__it); 12024ba319b5SDimitry Andric } 1203*b5893f02SDimitry Andric template <class _Compare2> 1204*b5893f02SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1205*b5893f02SDimitry Andric void merge(multiset<key_type, _Compare2, allocator_type>& __source) 1206*b5893f02SDimitry Andric { 1207*b5893f02SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1208*b5893f02SDimitry Andric "merging container with incompatible allocator"); 1209*b5893f02SDimitry Andric __tree_.__node_handle_merge_multi(__source.__tree_); 1210*b5893f02SDimitry Andric } 1211*b5893f02SDimitry Andric template <class _Compare2> 1212*b5893f02SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1213*b5893f02SDimitry Andric void merge(multiset<key_type, _Compare2, allocator_type>&& __source) 1214*b5893f02SDimitry Andric { 1215*b5893f02SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1216*b5893f02SDimitry Andric "merging container with incompatible allocator"); 1217*b5893f02SDimitry Andric __tree_.__node_handle_merge_multi(__source.__tree_); 1218*b5893f02SDimitry Andric } 1219*b5893f02SDimitry Andric template <class _Compare2> 1220*b5893f02SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1221*b5893f02SDimitry Andric void merge(set<key_type, _Compare2, allocator_type>& __source) 1222*b5893f02SDimitry Andric { 1223*b5893f02SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1224*b5893f02SDimitry Andric "merging container with incompatible allocator"); 1225*b5893f02SDimitry Andric __tree_.__node_handle_merge_multi(__source.__tree_); 1226*b5893f02SDimitry Andric } 1227*b5893f02SDimitry Andric template <class _Compare2> 1228*b5893f02SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1229*b5893f02SDimitry Andric void merge(set<key_type, _Compare2, allocator_type>&& __source) 1230*b5893f02SDimitry Andric { 1231*b5893f02SDimitry Andric _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), 1232*b5893f02SDimitry Andric "merging container with incompatible allocator"); 1233*b5893f02SDimitry Andric __tree_.__node_handle_merge_multi(__source.__tree_); 1234*b5893f02SDimitry Andric } 12354ba319b5SDimitry Andric#endif 12364ba319b5SDimitry Andric 12377a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12387a984708SDavid Chisnall void swap(multiset& __s) 12397a984708SDavid Chisnall _NOEXCEPT_(__is_nothrow_swappable<__base>::value) 12407a984708SDavid Chisnall {__tree_.swap(__s.__tree_);} 12417a984708SDavid Chisnall 12427a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12437a984708SDavid Chisnall allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();} 12447a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12457a984708SDavid Chisnall key_compare key_comp() const {return __tree_.value_comp();} 12467a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12477a984708SDavid Chisnall value_compare value_comp() const {return __tree_.value_comp();} 12487a984708SDavid Chisnall 12497a984708SDavid Chisnall // set operations: 12507a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12517a984708SDavid Chisnall iterator find(const key_type& __k) {return __tree_.find(__k);} 12527a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12537a984708SDavid Chisnall const_iterator find(const key_type& __k) const {return __tree_.find(__k);} 12544f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 12554f7ab58eSDimitry Andric template <typename _K2> 12564f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 12574f7ab58eSDimitry Andric typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type 12584f7ab58eSDimitry Andric find(const _K2& __k) {return __tree_.find(__k);} 12594f7ab58eSDimitry Andric template <typename _K2> 12604f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 12614f7ab58eSDimitry Andric typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type 12624f7ab58eSDimitry Andric find(const _K2& __k) const {return __tree_.find(__k);} 12634f7ab58eSDimitry Andric#endif 12644f7ab58eSDimitry Andric 12657a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12667a984708SDavid Chisnall size_type count(const key_type& __k) const 12677a984708SDavid Chisnall {return __tree_.__count_multi(__k);} 1268d72607e9SDimitry Andric#if _LIBCPP_STD_VER > 11 1269d72607e9SDimitry Andric template <typename _K2> 1270d72607e9SDimitry Andric _LIBCPP_INLINE_VISIBILITY 1271d72607e9SDimitry Andric typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type 12724ba319b5SDimitry Andric count(const _K2& __k) const {return __tree_.__count_multi(__k);} 1273d72607e9SDimitry Andric#endif 12744f7ab58eSDimitry Andric 12757a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12767a984708SDavid Chisnall iterator lower_bound(const key_type& __k) 12777a984708SDavid Chisnall {return __tree_.lower_bound(__k);} 12787a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12797a984708SDavid Chisnall const_iterator lower_bound(const key_type& __k) const 12807a984708SDavid Chisnall {return __tree_.lower_bound(__k);} 12814f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 12824f7ab58eSDimitry Andric template <typename _K2> 12834f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 12844f7ab58eSDimitry Andric typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type 12854f7ab58eSDimitry Andric lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} 12864f7ab58eSDimitry Andric 12874f7ab58eSDimitry Andric template <typename _K2> 12884f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 12894f7ab58eSDimitry Andric typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type 12904f7ab58eSDimitry Andric lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} 12914f7ab58eSDimitry Andric#endif 12924f7ab58eSDimitry Andric 12937a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12947a984708SDavid Chisnall iterator upper_bound(const key_type& __k) 12957a984708SDavid Chisnall {return __tree_.upper_bound(__k);} 12967a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 12977a984708SDavid Chisnall const_iterator upper_bound(const key_type& __k) const 12987a984708SDavid Chisnall {return __tree_.upper_bound(__k);} 12994f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 13004f7ab58eSDimitry Andric template <typename _K2> 13014f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 13024f7ab58eSDimitry Andric typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type 13034f7ab58eSDimitry Andric upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} 13044f7ab58eSDimitry Andric template <typename _K2> 13054f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 13064f7ab58eSDimitry Andric typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type 13074f7ab58eSDimitry Andric upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} 13084f7ab58eSDimitry Andric#endif 13094f7ab58eSDimitry Andric 13107a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 13117a984708SDavid Chisnall pair<iterator,iterator> equal_range(const key_type& __k) 13127a984708SDavid Chisnall {return __tree_.__equal_range_multi(__k);} 13137a984708SDavid Chisnall _LIBCPP_INLINE_VISIBILITY 13147a984708SDavid Chisnall pair<const_iterator,const_iterator> equal_range(const key_type& __k) const 13157a984708SDavid Chisnall {return __tree_.__equal_range_multi(__k);} 13164f7ab58eSDimitry Andric#if _LIBCPP_STD_VER > 11 13174f7ab58eSDimitry Andric template <typename _K2> 13184f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 13194f7ab58eSDimitry Andric typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type 13204f7ab58eSDimitry Andric equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} 13214f7ab58eSDimitry Andric template <typename _K2> 13224f7ab58eSDimitry Andric _LIBCPP_INLINE_VISIBILITY 13234f7ab58eSDimitry Andric typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type 13244f7ab58eSDimitry Andric equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} 13254f7ab58eSDimitry Andric#endif 13267a984708SDavid Chisnall}; 13277a984708SDavid Chisnall 1328540d2a8bSDimitry Andric#ifndef _LIBCPP_CXX03_LANG 13297a984708SDavid Chisnall 13307a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 13317a984708SDavid Chisnallmultiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) 13327a984708SDavid Chisnall : __tree_(_VSTD::move(__s.__tree_), __a) 13337a984708SDavid Chisnall{ 13347a984708SDavid Chisnall if (__a != __s.get_allocator()) 13357a984708SDavid Chisnall { 13367a984708SDavid Chisnall const_iterator __e = cend(); 13377a984708SDavid Chisnall while (!__s.empty()) 13387a984708SDavid Chisnall insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_)); 13397a984708SDavid Chisnall } 13407a984708SDavid Chisnall} 13417a984708SDavid Chisnall 1342540d2a8bSDimitry Andric#endif // _LIBCPP_CXX03_LANG 13437a984708SDavid Chisnall 13447a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 13457a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 13467a984708SDavid Chisnallbool 13477a984708SDavid Chisnalloperator==(const multiset<_Key, _Compare, _Allocator>& __x, 13487a984708SDavid Chisnall const multiset<_Key, _Compare, _Allocator>& __y) 13497a984708SDavid Chisnall{ 13507a984708SDavid Chisnall return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); 13517a984708SDavid Chisnall} 13527a984708SDavid Chisnall 13537a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 13547a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 13557a984708SDavid Chisnallbool 13567a984708SDavid Chisnalloperator< (const multiset<_Key, _Compare, _Allocator>& __x, 13577a984708SDavid Chisnall const multiset<_Key, _Compare, _Allocator>& __y) 13587a984708SDavid Chisnall{ 13597a984708SDavid Chisnall return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); 13607a984708SDavid Chisnall} 13617a984708SDavid Chisnall 13627a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 13637a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 13647a984708SDavid Chisnallbool 13657a984708SDavid Chisnalloperator!=(const multiset<_Key, _Compare, _Allocator>& __x, 13667a984708SDavid Chisnall const multiset<_Key, _Compare, _Allocator>& __y) 13677a984708SDavid Chisnall{ 13687a984708SDavid Chisnall return !(__x == __y); 13697a984708SDavid Chisnall} 13707a984708SDavid Chisnall 13717a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 13727a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 13737a984708SDavid Chisnallbool 13747a984708SDavid Chisnalloperator> (const multiset<_Key, _Compare, _Allocator>& __x, 13757a984708SDavid Chisnall const multiset<_Key, _Compare, _Allocator>& __y) 13767a984708SDavid Chisnall{ 13777a984708SDavid Chisnall return __y < __x; 13787a984708SDavid Chisnall} 13797a984708SDavid Chisnall 13807a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 13817a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 13827a984708SDavid Chisnallbool 13837a984708SDavid Chisnalloperator>=(const multiset<_Key, _Compare, _Allocator>& __x, 13847a984708SDavid Chisnall const multiset<_Key, _Compare, _Allocator>& __y) 13857a984708SDavid Chisnall{ 13867a984708SDavid Chisnall return !(__x < __y); 13877a984708SDavid Chisnall} 13887a984708SDavid Chisnall 13897a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 13907a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 13917a984708SDavid Chisnallbool 13927a984708SDavid Chisnalloperator<=(const multiset<_Key, _Compare, _Allocator>& __x, 13937a984708SDavid Chisnall const multiset<_Key, _Compare, _Allocator>& __y) 13947a984708SDavid Chisnall{ 13957a984708SDavid Chisnall return !(__y < __x); 13967a984708SDavid Chisnall} 13977a984708SDavid Chisnall 13987a984708SDavid Chisnalltemplate <class _Key, class _Compare, class _Allocator> 13997a984708SDavid Chisnallinline _LIBCPP_INLINE_VISIBILITY 14007a984708SDavid Chisnallvoid 14017a984708SDavid Chisnallswap(multiset<_Key, _Compare, _Allocator>& __x, 14027a984708SDavid Chisnall multiset<_Key, _Compare, _Allocator>& __y) 14037a984708SDavid Chisnall _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 14047a984708SDavid Chisnall{ 14057a984708SDavid Chisnall __x.swap(__y); 14067a984708SDavid Chisnall} 14077a984708SDavid Chisnall 1408*b5893f02SDimitry Andric#if _LIBCPP_STD_VER > 17 1409*b5893f02SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator, class _Predicate> 1410*b5893f02SDimitry Andricinline _LIBCPP_INLINE_VISIBILITY 1411*b5893f02SDimitry Andricvoid erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) 1412*b5893f02SDimitry Andric{ __libcpp_erase_if_container(__c, __pred); } 1413*b5893f02SDimitry Andric#endif 1414*b5893f02SDimitry Andric 14157a984708SDavid Chisnall_LIBCPP_END_NAMESPACE_STD 14167a984708SDavid Chisnall 14177a984708SDavid Chisnall#endif // _LIBCPP_SET 1418