10b57cec5SDimitry Andric// -*- C++ -*- 2349cc55cSDimitry Andric//===----------------------------------------------------------------------===// 30b57cec5SDimitry Andric// 40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 70b57cec5SDimitry Andric// 80b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 90b57cec5SDimitry Andric 100b57cec5SDimitry Andric#ifndef _LIBCPP_SET 110b57cec5SDimitry Andric#define _LIBCPP_SET 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric/* 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric set synopsis 160b57cec5SDimitry Andric 170b57cec5SDimitry Andricnamespace std 180b57cec5SDimitry Andric{ 190b57cec5SDimitry Andric 200b57cec5SDimitry Andrictemplate <class Key, class Compare = less<Key>, 210b57cec5SDimitry Andric class Allocator = allocator<Key>> 220b57cec5SDimitry Andricclass set 230b57cec5SDimitry Andric{ 240b57cec5SDimitry Andricpublic: 250b57cec5SDimitry Andric // types: 260b57cec5SDimitry Andric typedef Key key_type; 270b57cec5SDimitry Andric typedef key_type value_type; 280b57cec5SDimitry Andric typedef Compare key_compare; 290b57cec5SDimitry Andric typedef key_compare value_compare; 300b57cec5SDimitry Andric typedef Allocator allocator_type; 310b57cec5SDimitry Andric typedef typename allocator_type::reference reference; 320b57cec5SDimitry Andric typedef typename allocator_type::const_reference const_reference; 330b57cec5SDimitry Andric typedef typename allocator_type::size_type size_type; 340b57cec5SDimitry Andric typedef typename allocator_type::difference_type difference_type; 350b57cec5SDimitry Andric typedef typename allocator_type::pointer pointer; 360b57cec5SDimitry Andric typedef typename allocator_type::const_pointer const_pointer; 370b57cec5SDimitry Andric 380b57cec5SDimitry Andric typedef implementation-defined iterator; 390b57cec5SDimitry Andric typedef implementation-defined const_iterator; 400b57cec5SDimitry Andric typedef std::reverse_iterator<iterator> reverse_iterator; 410b57cec5SDimitry Andric typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 420b57cec5SDimitry Andric typedef unspecified node_type; // C++17 430b57cec5SDimitry Andric typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17 440b57cec5SDimitry Andric 450b57cec5SDimitry Andric // construct/copy/destroy: 460b57cec5SDimitry Andric set() 470b57cec5SDimitry Andric noexcept( 480b57cec5SDimitry Andric is_nothrow_default_constructible<allocator_type>::value && 490b57cec5SDimitry Andric is_nothrow_default_constructible<key_compare>::value && 500b57cec5SDimitry Andric is_nothrow_copy_constructible<key_compare>::value); 510b57cec5SDimitry Andric explicit set(const value_compare& comp); 520b57cec5SDimitry Andric set(const value_compare& comp, const allocator_type& a); 530b57cec5SDimitry Andric template <class InputIterator> 540b57cec5SDimitry Andric set(InputIterator first, InputIterator last, 550b57cec5SDimitry Andric const value_compare& comp = value_compare()); 560b57cec5SDimitry Andric template <class InputIterator> 570b57cec5SDimitry Andric set(InputIterator first, InputIterator last, const value_compare& comp, 580b57cec5SDimitry Andric const allocator_type& a); 5906c3fb27SDimitry Andric template<container-compatible-range<value_type> R> 6006c3fb27SDimitry Andric set(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23 610b57cec5SDimitry Andric set(const set& s); 620b57cec5SDimitry Andric set(set&& s) 630b57cec5SDimitry Andric noexcept( 640b57cec5SDimitry Andric is_nothrow_move_constructible<allocator_type>::value && 650b57cec5SDimitry Andric is_nothrow_move_constructible<key_compare>::value); 660b57cec5SDimitry Andric explicit set(const allocator_type& a); 670b57cec5SDimitry Andric set(const set& s, const allocator_type& a); 680b57cec5SDimitry Andric set(set&& s, const allocator_type& a); 690b57cec5SDimitry Andric set(initializer_list<value_type> il, const value_compare& comp = value_compare()); 700b57cec5SDimitry Andric set(initializer_list<value_type> il, const value_compare& comp, 710b57cec5SDimitry Andric const allocator_type& a); 720b57cec5SDimitry Andric template <class InputIterator> 730b57cec5SDimitry Andric set(InputIterator first, InputIterator last, const allocator_type& a) 740b57cec5SDimitry Andric : set(first, last, Compare(), a) {} // C++14 7506c3fb27SDimitry Andric template<container-compatible-range<value_type> R> 7606c3fb27SDimitry Andric set(from_range_t, R&& rg, const Allocator& a)) 7706c3fb27SDimitry Andric : set(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 780b57cec5SDimitry Andric set(initializer_list<value_type> il, const allocator_type& a) 790b57cec5SDimitry Andric : set(il, Compare(), a) {} // C++14 800b57cec5SDimitry Andric ~set(); 810b57cec5SDimitry Andric 820b57cec5SDimitry Andric set& operator=(const set& s); 830b57cec5SDimitry Andric set& operator=(set&& s) 840b57cec5SDimitry Andric noexcept( 850b57cec5SDimitry Andric allocator_type::propagate_on_container_move_assignment::value && 860b57cec5SDimitry Andric is_nothrow_move_assignable<allocator_type>::value && 870b57cec5SDimitry Andric is_nothrow_move_assignable<key_compare>::value); 880b57cec5SDimitry Andric set& operator=(initializer_list<value_type> il); 890b57cec5SDimitry Andric 900b57cec5SDimitry Andric // iterators: 910b57cec5SDimitry Andric iterator begin() noexcept; 920b57cec5SDimitry Andric const_iterator begin() const noexcept; 930b57cec5SDimitry Andric iterator end() noexcept; 940b57cec5SDimitry Andric const_iterator end() const noexcept; 950b57cec5SDimitry Andric 960b57cec5SDimitry Andric reverse_iterator rbegin() noexcept; 970b57cec5SDimitry Andric const_reverse_iterator rbegin() const noexcept; 980b57cec5SDimitry Andric reverse_iterator rend() noexcept; 990b57cec5SDimitry Andric const_reverse_iterator rend() const noexcept; 1000b57cec5SDimitry Andric 1010b57cec5SDimitry Andric const_iterator cbegin() const noexcept; 1020b57cec5SDimitry Andric const_iterator cend() const noexcept; 1030b57cec5SDimitry Andric const_reverse_iterator crbegin() const noexcept; 1040b57cec5SDimitry Andric const_reverse_iterator crend() const noexcept; 1050b57cec5SDimitry Andric 1060b57cec5SDimitry Andric // capacity: 1070b57cec5SDimitry Andric bool empty() const noexcept; 1080b57cec5SDimitry Andric size_type size() const noexcept; 1090b57cec5SDimitry Andric size_type max_size() const noexcept; 1100b57cec5SDimitry Andric 1110b57cec5SDimitry Andric // modifiers: 1120b57cec5SDimitry Andric template <class... Args> 1130b57cec5SDimitry Andric pair<iterator, bool> emplace(Args&&... args); 1140b57cec5SDimitry Andric template <class... Args> 1150b57cec5SDimitry Andric iterator emplace_hint(const_iterator position, Args&&... args); 1160b57cec5SDimitry Andric pair<iterator,bool> insert(const value_type& v); 1170b57cec5SDimitry Andric pair<iterator,bool> insert(value_type&& v); 1180b57cec5SDimitry Andric iterator insert(const_iterator position, const value_type& v); 1190b57cec5SDimitry Andric iterator insert(const_iterator position, value_type&& v); 1200b57cec5SDimitry Andric template <class InputIterator> 1210b57cec5SDimitry Andric void insert(InputIterator first, InputIterator last); 12206c3fb27SDimitry Andric template<container-compatible-range<value_type> R> 12306c3fb27SDimitry Andric void insert_range(R&& rg); // C++23 1240b57cec5SDimitry Andric void insert(initializer_list<value_type> il); 1250b57cec5SDimitry Andric 1260b57cec5SDimitry Andric node_type extract(const_iterator position); // C++17 1270b57cec5SDimitry Andric node_type extract(const key_type& x); // C++17 1280b57cec5SDimitry Andric insert_return_type insert(node_type&& nh); // C++17 1290b57cec5SDimitry Andric iterator insert(const_iterator hint, node_type&& nh); // C++17 1300b57cec5SDimitry Andric 1310b57cec5SDimitry Andric iterator erase(const_iterator position); 1320b57cec5SDimitry Andric iterator erase(iterator position); // C++14 1330b57cec5SDimitry Andric size_type erase(const key_type& k); 1340b57cec5SDimitry Andric iterator erase(const_iterator first, const_iterator last); 1350b57cec5SDimitry Andric void clear() noexcept; 1360b57cec5SDimitry Andric 1370b57cec5SDimitry Andric template<class C2> 1380b57cec5SDimitry Andric void merge(set<Key, C2, Allocator>& source); // C++17 1390b57cec5SDimitry Andric template<class C2> 1400b57cec5SDimitry Andric void merge(set<Key, C2, Allocator>&& source); // C++17 1410b57cec5SDimitry Andric template<class C2> 1420b57cec5SDimitry Andric void merge(multiset<Key, C2, Allocator>& source); // C++17 1430b57cec5SDimitry Andric template<class C2> 1440b57cec5SDimitry Andric void merge(multiset<Key, C2, Allocator>&& source); // C++17 1450b57cec5SDimitry Andric 1460b57cec5SDimitry Andric void swap(set& s) 1470b57cec5SDimitry Andric noexcept( 1480b57cec5SDimitry Andric __is_nothrow_swappable<key_compare>::value && 1490b57cec5SDimitry Andric (!allocator_type::propagate_on_container_swap::value || 1500b57cec5SDimitry Andric __is_nothrow_swappable<allocator_type>::value)); 1510b57cec5SDimitry Andric 1520b57cec5SDimitry Andric // observers: 1530b57cec5SDimitry Andric allocator_type get_allocator() const noexcept; 1540b57cec5SDimitry Andric key_compare key_comp() const; 1550b57cec5SDimitry Andric value_compare value_comp() const; 1560b57cec5SDimitry Andric 1570b57cec5SDimitry Andric // set operations: 1580b57cec5SDimitry Andric iterator find(const key_type& k); 1590b57cec5SDimitry Andric const_iterator find(const key_type& k) const; 1600b57cec5SDimitry Andric template<typename K> 1610b57cec5SDimitry Andric iterator find(const K& x); 1620b57cec5SDimitry Andric template<typename K> 1630b57cec5SDimitry Andric const_iterator find(const K& x) const; // C++14 164fe6060f1SDimitry Andric 1650b57cec5SDimitry Andric template<typename K> 1660b57cec5SDimitry Andric size_type count(const K& x) const; // C++14 1670b57cec5SDimitry Andric size_type count(const key_type& k) const; 168fe6060f1SDimitry Andric 1690b57cec5SDimitry Andric bool contains(const key_type& x) const; // C++20 170fe6060f1SDimitry Andric template<class K> bool contains(const K& x) const; // C++20 171fe6060f1SDimitry Andric 1720b57cec5SDimitry Andric iterator lower_bound(const key_type& k); 1730b57cec5SDimitry Andric const_iterator lower_bound(const key_type& k) const; 1740b57cec5SDimitry Andric template<typename K> 1750b57cec5SDimitry Andric iterator lower_bound(const K& x); // C++14 1760b57cec5SDimitry Andric template<typename K> 1770b57cec5SDimitry Andric const_iterator lower_bound(const K& x) const; // C++14 1780b57cec5SDimitry Andric 1790b57cec5SDimitry Andric iterator upper_bound(const key_type& k); 1800b57cec5SDimitry Andric const_iterator upper_bound(const key_type& k) const; 1810b57cec5SDimitry Andric template<typename K> 1820b57cec5SDimitry Andric iterator upper_bound(const K& x); // C++14 1830b57cec5SDimitry Andric template<typename K> 1840b57cec5SDimitry Andric const_iterator upper_bound(const K& x) const; // C++14 1850b57cec5SDimitry Andric pair<iterator,iterator> equal_range(const key_type& k); 1860b57cec5SDimitry Andric pair<const_iterator,const_iterator> equal_range(const key_type& k) const; 1870b57cec5SDimitry Andric template<typename K> 1880b57cec5SDimitry Andric pair<iterator,iterator> equal_range(const K& x); // C++14 1890b57cec5SDimitry Andric template<typename K> 1900b57cec5SDimitry Andric pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 1910b57cec5SDimitry Andric}; 1920b57cec5SDimitry Andric 193349cc55cSDimitry Andrictemplate <class InputIterator, 194349cc55cSDimitry Andric class Compare = less<typename iterator_traits<InputIterator>::value_type>, 195349cc55cSDimitry Andric class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> 196349cc55cSDimitry Andricset(InputIterator, InputIterator, 197349cc55cSDimitry Andric Compare = Compare(), Allocator = Allocator()) 198349cc55cSDimitry Andric -> set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>; // C++17 199349cc55cSDimitry Andric 20006c3fb27SDimitry Andrictemplate<ranges::input_range R, class Compare = less<ranges::range_value_t<R>>, 20106c3fb27SDimitry Andric class Allocator = allocator<ranges::range_value_t<R>>> 20206c3fb27SDimitry Andric set(from_range_t, R&&, Compare = Compare(), Allocator = Allocator()) 20306c3fb27SDimitry Andric -> set<ranges::range_value_t<R>, Compare, Allocator>; // C++23 20406c3fb27SDimitry Andric 205349cc55cSDimitry Andrictemplate<class Key, class Compare = less<Key>, class Allocator = allocator<Key>> 206349cc55cSDimitry Andricset(initializer_list<Key>, Compare = Compare(), Allocator = Allocator()) 207349cc55cSDimitry Andric -> set<Key, Compare, Allocator>; // C++17 208349cc55cSDimitry Andric 209349cc55cSDimitry Andrictemplate<class InputIterator, class Allocator> 210349cc55cSDimitry Andricset(InputIterator, InputIterator, Allocator) 211349cc55cSDimitry Andric -> set<typename iterator_traits<InputIterator>::value_type, 212349cc55cSDimitry Andric less<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17 213349cc55cSDimitry Andric 21406c3fb27SDimitry Andrictemplate<ranges::input_range R, class Allocator> 21506c3fb27SDimitry Andric set(from_range_t, R&&, Allocator) 21606c3fb27SDimitry Andric -> set<ranges::range_value_t<R>, less<ranges::range_value_t<R>>, Allocator>; // C++23 21706c3fb27SDimitry Andric 218349cc55cSDimitry Andrictemplate<class Key, class Allocator> 219349cc55cSDimitry Andricset(initializer_list<Key>, Allocator) -> set<Key, less<Key>, Allocator>; // C++17 220349cc55cSDimitry Andric 2210b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 2220b57cec5SDimitry Andricbool 2230b57cec5SDimitry Andricoperator==(const set<Key, Compare, Allocator>& x, 2240b57cec5SDimitry Andric const set<Key, Compare, Allocator>& y); 2250b57cec5SDimitry Andric 2260b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 2270b57cec5SDimitry Andricbool 2280b57cec5SDimitry Andricoperator< (const set<Key, Compare, Allocator>& x, 22906c3fb27SDimitry Andric const set<Key, Compare, Allocator>& y); // removed in C++20 2300b57cec5SDimitry Andric 2310b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 2320b57cec5SDimitry Andricbool 2330b57cec5SDimitry Andricoperator!=(const set<Key, Compare, Allocator>& x, 23406c3fb27SDimitry Andric const set<Key, Compare, Allocator>& y); // removed in C++20 2350b57cec5SDimitry Andric 2360b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 2370b57cec5SDimitry Andricbool 2380b57cec5SDimitry Andricoperator> (const set<Key, Compare, Allocator>& x, 23906c3fb27SDimitry Andric const set<Key, Compare, Allocator>& y); // removed in C++20 2400b57cec5SDimitry Andric 2410b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 2420b57cec5SDimitry Andricbool 2430b57cec5SDimitry Andricoperator>=(const set<Key, Compare, Allocator>& x, 24406c3fb27SDimitry Andric const set<Key, Compare, Allocator>& y); // removed in C++20 2450b57cec5SDimitry Andric 2460b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 2470b57cec5SDimitry Andricbool 2480b57cec5SDimitry Andricoperator<=(const set<Key, Compare, Allocator>& x, 24906c3fb27SDimitry Andric const set<Key, Compare, Allocator>& y); // removed in C++20 25006c3fb27SDimitry Andric 25106c3fb27SDimitry Andrictemplate<class Key, class Compare, class Allocator> 25206c3fb27SDimitry Andric synth-three-way-result<Key> operator<=>(const set<Key, Compare, Allocator>& x, 25306c3fb27SDimitry Andric const set<Key, Compare, Allocator>& y); // since C++20 2540b57cec5SDimitry Andric 2550b57cec5SDimitry Andric// specialized algorithms: 2560b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 2570b57cec5SDimitry Andricvoid 2580b57cec5SDimitry Andricswap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y) 2590b57cec5SDimitry Andric noexcept(noexcept(x.swap(y))); 2600b57cec5SDimitry Andric 2610b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator, class Predicate> 2625ffd83dbSDimitry Andrictypename set<Key, Compare, Allocator>::size_type 2635ffd83dbSDimitry Andricerase_if(set<Key, Compare, Allocator>& c, Predicate pred); // C++20 2640b57cec5SDimitry Andric 2650b57cec5SDimitry Andrictemplate <class Key, class Compare = less<Key>, 2660b57cec5SDimitry Andric class Allocator = allocator<Key>> 2670b57cec5SDimitry Andricclass multiset 2680b57cec5SDimitry Andric{ 2690b57cec5SDimitry Andricpublic: 2700b57cec5SDimitry Andric // types: 2710b57cec5SDimitry Andric typedef Key key_type; 2720b57cec5SDimitry Andric typedef key_type value_type; 2730b57cec5SDimitry Andric typedef Compare key_compare; 2740b57cec5SDimitry Andric typedef key_compare value_compare; 2750b57cec5SDimitry Andric typedef Allocator allocator_type; 2760b57cec5SDimitry Andric typedef typename allocator_type::reference reference; 2770b57cec5SDimitry Andric typedef typename allocator_type::const_reference const_reference; 2780b57cec5SDimitry Andric typedef typename allocator_type::size_type size_type; 2790b57cec5SDimitry Andric typedef typename allocator_type::difference_type difference_type; 2800b57cec5SDimitry Andric typedef typename allocator_type::pointer pointer; 2810b57cec5SDimitry Andric typedef typename allocator_type::const_pointer const_pointer; 2820b57cec5SDimitry Andric 2830b57cec5SDimitry Andric typedef implementation-defined iterator; 2840b57cec5SDimitry Andric typedef implementation-defined const_iterator; 2850b57cec5SDimitry Andric typedef std::reverse_iterator<iterator> reverse_iterator; 2860b57cec5SDimitry Andric typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 2870b57cec5SDimitry Andric typedef unspecified node_type; // C++17 2880b57cec5SDimitry Andric 2890b57cec5SDimitry Andric // construct/copy/destroy: 2900b57cec5SDimitry Andric multiset() 2910b57cec5SDimitry Andric noexcept( 2920b57cec5SDimitry Andric is_nothrow_default_constructible<allocator_type>::value && 2930b57cec5SDimitry Andric is_nothrow_default_constructible<key_compare>::value && 2940b57cec5SDimitry Andric is_nothrow_copy_constructible<key_compare>::value); 2950b57cec5SDimitry Andric explicit multiset(const value_compare& comp); 2960b57cec5SDimitry Andric multiset(const value_compare& comp, const allocator_type& a); 2970b57cec5SDimitry Andric template <class InputIterator> 2980b57cec5SDimitry Andric multiset(InputIterator first, InputIterator last, 2990b57cec5SDimitry Andric const value_compare& comp = value_compare()); 3000b57cec5SDimitry Andric template <class InputIterator> 3010b57cec5SDimitry Andric multiset(InputIterator first, InputIterator last, 3020b57cec5SDimitry Andric const value_compare& comp, const allocator_type& a); 30306c3fb27SDimitry Andric template<container-compatible-range<value_type> R> 30406c3fb27SDimitry Andric multiset(from_range_t, R&& rg, 30506c3fb27SDimitry Andric const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23 3060b57cec5SDimitry Andric multiset(const multiset& s); 3070b57cec5SDimitry Andric multiset(multiset&& s) 3080b57cec5SDimitry Andric noexcept( 3090b57cec5SDimitry Andric is_nothrow_move_constructible<allocator_type>::value && 3100b57cec5SDimitry Andric is_nothrow_move_constructible<key_compare>::value); 3110b57cec5SDimitry Andric explicit multiset(const allocator_type& a); 3120b57cec5SDimitry Andric multiset(const multiset& s, const allocator_type& a); 3130b57cec5SDimitry Andric multiset(multiset&& s, const allocator_type& a); 3140b57cec5SDimitry Andric multiset(initializer_list<value_type> il, const value_compare& comp = value_compare()); 3150b57cec5SDimitry Andric multiset(initializer_list<value_type> il, const value_compare& comp, 3160b57cec5SDimitry Andric const allocator_type& a); 3170b57cec5SDimitry Andric template <class InputIterator> 3180b57cec5SDimitry Andric multiset(InputIterator first, InputIterator last, const allocator_type& a) 3190b57cec5SDimitry Andric : set(first, last, Compare(), a) {} // C++14 32006c3fb27SDimitry Andric template<container-compatible-range<value_type> R> 32106c3fb27SDimitry Andric multiset(from_range_t, R&& rg, const Allocator& a)) 32206c3fb27SDimitry Andric : multiset(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 3230b57cec5SDimitry Andric multiset(initializer_list<value_type> il, const allocator_type& a) 3240b57cec5SDimitry Andric : set(il, Compare(), a) {} // C++14 3250b57cec5SDimitry Andric ~multiset(); 3260b57cec5SDimitry Andric 3270b57cec5SDimitry Andric multiset& operator=(const multiset& s); 3280b57cec5SDimitry Andric multiset& operator=(multiset&& s) 3290b57cec5SDimitry Andric noexcept( 3300b57cec5SDimitry Andric allocator_type::propagate_on_container_move_assignment::value && 3310b57cec5SDimitry Andric is_nothrow_move_assignable<allocator_type>::value && 3320b57cec5SDimitry Andric is_nothrow_move_assignable<key_compare>::value); 3330b57cec5SDimitry Andric multiset& operator=(initializer_list<value_type> il); 3340b57cec5SDimitry Andric 3350b57cec5SDimitry Andric // iterators: 3360b57cec5SDimitry Andric iterator begin() noexcept; 3370b57cec5SDimitry Andric const_iterator begin() const noexcept; 3380b57cec5SDimitry Andric iterator end() noexcept; 3390b57cec5SDimitry Andric const_iterator end() const noexcept; 3400b57cec5SDimitry Andric 3410b57cec5SDimitry Andric reverse_iterator rbegin() noexcept; 3420b57cec5SDimitry Andric const_reverse_iterator rbegin() const noexcept; 3430b57cec5SDimitry Andric reverse_iterator rend() noexcept; 3440b57cec5SDimitry Andric const_reverse_iterator rend() const noexcept; 3450b57cec5SDimitry Andric 3460b57cec5SDimitry Andric const_iterator cbegin() const noexcept; 3470b57cec5SDimitry Andric const_iterator cend() const noexcept; 3480b57cec5SDimitry Andric const_reverse_iterator crbegin() const noexcept; 3490b57cec5SDimitry Andric const_reverse_iterator crend() const noexcept; 3500b57cec5SDimitry Andric 3510b57cec5SDimitry Andric // capacity: 3520b57cec5SDimitry Andric bool empty() const noexcept; 3530b57cec5SDimitry Andric size_type size() const noexcept; 3540b57cec5SDimitry Andric size_type max_size() const noexcept; 3550b57cec5SDimitry Andric 3560b57cec5SDimitry Andric // modifiers: 3570b57cec5SDimitry Andric template <class... Args> 3580b57cec5SDimitry Andric iterator emplace(Args&&... args); 3590b57cec5SDimitry Andric template <class... Args> 3600b57cec5SDimitry Andric iterator emplace_hint(const_iterator position, Args&&... args); 3610b57cec5SDimitry Andric iterator insert(const value_type& v); 3620b57cec5SDimitry Andric iterator insert(value_type&& v); 3630b57cec5SDimitry Andric iterator insert(const_iterator position, const value_type& v); 3640b57cec5SDimitry Andric iterator insert(const_iterator position, value_type&& v); 3650b57cec5SDimitry Andric template <class InputIterator> 3660b57cec5SDimitry Andric void insert(InputIterator first, InputIterator last); 36706c3fb27SDimitry Andric template<container-compatible-range<value_type> R> 36806c3fb27SDimitry Andric void insert_range(R&& rg); // C++23 3690b57cec5SDimitry Andric void insert(initializer_list<value_type> il); 3700b57cec5SDimitry Andric 3710b57cec5SDimitry Andric node_type extract(const_iterator position); // C++17 3720b57cec5SDimitry Andric node_type extract(const key_type& x); // C++17 3730b57cec5SDimitry Andric iterator insert(node_type&& nh); // C++17 3740b57cec5SDimitry Andric iterator insert(const_iterator hint, node_type&& nh); // C++17 3750b57cec5SDimitry Andric 3760b57cec5SDimitry Andric iterator erase(const_iterator position); 3770b57cec5SDimitry Andric iterator erase(iterator position); // C++14 3780b57cec5SDimitry Andric size_type erase(const key_type& k); 3790b57cec5SDimitry Andric iterator erase(const_iterator first, const_iterator last); 3800b57cec5SDimitry Andric void clear() noexcept; 3810b57cec5SDimitry Andric 3820b57cec5SDimitry Andric template<class C2> 3830b57cec5SDimitry Andric void merge(multiset<Key, C2, Allocator>& source); // C++17 3840b57cec5SDimitry Andric template<class C2> 3850b57cec5SDimitry Andric void merge(multiset<Key, C2, Allocator>&& source); // C++17 3860b57cec5SDimitry Andric template<class C2> 3870b57cec5SDimitry Andric void merge(set<Key, C2, Allocator>& source); // C++17 3880b57cec5SDimitry Andric template<class C2> 3890b57cec5SDimitry Andric void merge(set<Key, C2, Allocator>&& source); // C++17 3900b57cec5SDimitry Andric 3910b57cec5SDimitry Andric void swap(multiset& s) 3920b57cec5SDimitry Andric noexcept( 3930b57cec5SDimitry Andric __is_nothrow_swappable<key_compare>::value && 3940b57cec5SDimitry Andric (!allocator_type::propagate_on_container_swap::value || 3950b57cec5SDimitry Andric __is_nothrow_swappable<allocator_type>::value)); 3960b57cec5SDimitry Andric 3970b57cec5SDimitry Andric // observers: 3980b57cec5SDimitry Andric allocator_type get_allocator() const noexcept; 3990b57cec5SDimitry Andric key_compare key_comp() const; 4000b57cec5SDimitry Andric value_compare value_comp() const; 4010b57cec5SDimitry Andric 4020b57cec5SDimitry Andric // set operations: 4030b57cec5SDimitry Andric iterator find(const key_type& k); 4040b57cec5SDimitry Andric const_iterator find(const key_type& k) const; 4050b57cec5SDimitry Andric template<typename K> 4060b57cec5SDimitry Andric iterator find(const K& x); 4070b57cec5SDimitry Andric template<typename K> 4080b57cec5SDimitry Andric const_iterator find(const K& x) const; // C++14 409fe6060f1SDimitry Andric 4100b57cec5SDimitry Andric template<typename K> 4110b57cec5SDimitry Andric size_type count(const K& x) const; // C++14 4120b57cec5SDimitry Andric size_type count(const key_type& k) const; 413fe6060f1SDimitry Andric 4140b57cec5SDimitry Andric bool contains(const key_type& x) const; // C++20 415fe6060f1SDimitry Andric template<class K> bool contains(const K& x) const; // C++20 416fe6060f1SDimitry Andric 4170b57cec5SDimitry Andric iterator lower_bound(const key_type& k); 4180b57cec5SDimitry Andric const_iterator lower_bound(const key_type& k) const; 4190b57cec5SDimitry Andric template<typename K> 4200b57cec5SDimitry Andric iterator lower_bound(const K& x); // C++14 4210b57cec5SDimitry Andric template<typename K> 4220b57cec5SDimitry Andric const_iterator lower_bound(const K& x) const; // C++14 4230b57cec5SDimitry Andric 4240b57cec5SDimitry Andric iterator upper_bound(const key_type& k); 4250b57cec5SDimitry Andric const_iterator upper_bound(const key_type& k) const; 4260b57cec5SDimitry Andric template<typename K> 4270b57cec5SDimitry Andric iterator upper_bound(const K& x); // C++14 4280b57cec5SDimitry Andric template<typename K> 4290b57cec5SDimitry Andric const_iterator upper_bound(const K& x) const; // C++14 4300b57cec5SDimitry Andric 4310b57cec5SDimitry Andric pair<iterator,iterator> equal_range(const key_type& k); 4320b57cec5SDimitry Andric pair<const_iterator,const_iterator> equal_range(const key_type& k) const; 4330b57cec5SDimitry Andric template<typename K> 4340b57cec5SDimitry Andric pair<iterator,iterator> equal_range(const K& x); // C++14 4350b57cec5SDimitry Andric template<typename K> 4360b57cec5SDimitry Andric pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 4370b57cec5SDimitry Andric}; 4380b57cec5SDimitry Andric 439349cc55cSDimitry Andrictemplate <class InputIterator, 440349cc55cSDimitry Andric class Compare = less<typename iterator_traits<InputIterator>::value_type>, 441349cc55cSDimitry Andric class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> 442349cc55cSDimitry Andricmultiset(InputIterator, InputIterator, 443349cc55cSDimitry Andric Compare = Compare(), Allocator = Allocator()) 444349cc55cSDimitry Andric -> multiset<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>; // C++17 445349cc55cSDimitry Andric 44606c3fb27SDimitry Andrictemplate<ranges::input_range R, class Compare = less<ranges::range_value_t<R>>, 44706c3fb27SDimitry Andric class Allocator = allocator<ranges::range_value_t<R>>> 44806c3fb27SDimitry Andric multiset(from_range_t, R&&, Compare = Compare(), Allocator = Allocator()) 44906c3fb27SDimitry Andric -> multiset<ranges::range_value_t<R>, Compare, Allocator>; 45006c3fb27SDimitry Andric 451349cc55cSDimitry Andrictemplate<class Key, class Compare = less<Key>, class Allocator = allocator<Key>> 452349cc55cSDimitry Andricmultiset(initializer_list<Key>, Compare = Compare(), Allocator = Allocator()) 453349cc55cSDimitry Andric -> multiset<Key, Compare, Allocator>; // C++17 454349cc55cSDimitry Andric 455349cc55cSDimitry Andrictemplate<class InputIterator, class Allocator> 456349cc55cSDimitry Andricmultiset(InputIterator, InputIterator, Allocator) 457349cc55cSDimitry Andric -> multiset<typename iterator_traits<InputIterator>::value_type, 458349cc55cSDimitry Andric less<typename iterator_traits<InputIterator>::value_type>, Allocator>; // C++17 459349cc55cSDimitry Andric 46006c3fb27SDimitry Andrictemplate<ranges::input_range R, class Allocator> 46106c3fb27SDimitry Andric multiset(from_range_t, R&&, Allocator) 46206c3fb27SDimitry Andric -> multiset<ranges::range_value_t<R>, less<ranges::range_value_t<R>>, Allocator>; 46306c3fb27SDimitry Andric 464349cc55cSDimitry Andrictemplate<class Key, class Allocator> 465349cc55cSDimitry Andricmultiset(initializer_list<Key>, Allocator) -> multiset<Key, less<Key>, Allocator>; // C++17 466349cc55cSDimitry Andric 4670b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 4680b57cec5SDimitry Andricbool 4690b57cec5SDimitry Andricoperator==(const multiset<Key, Compare, Allocator>& x, 4700b57cec5SDimitry Andric const multiset<Key, Compare, Allocator>& y); 4710b57cec5SDimitry Andric 4720b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 4730b57cec5SDimitry Andricbool 4740b57cec5SDimitry Andricoperator< (const multiset<Key, Compare, Allocator>& x, 47506c3fb27SDimitry Andric const multiset<Key, Compare, Allocator>& y); // removed in C++20 4760b57cec5SDimitry Andric 4770b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 4780b57cec5SDimitry Andricbool 4790b57cec5SDimitry Andricoperator!=(const multiset<Key, Compare, Allocator>& x, 48006c3fb27SDimitry Andric const multiset<Key, Compare, Allocator>& y); // removed in C++20 4810b57cec5SDimitry Andric 4820b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 4830b57cec5SDimitry Andricbool 4840b57cec5SDimitry Andricoperator> (const multiset<Key, Compare, Allocator>& x, 48506c3fb27SDimitry Andric const multiset<Key, Compare, Allocator>& y); // removed in C++20 4860b57cec5SDimitry Andric 4870b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 4880b57cec5SDimitry Andricbool 4890b57cec5SDimitry Andricoperator>=(const multiset<Key, Compare, Allocator>& x, 49006c3fb27SDimitry Andric const multiset<Key, Compare, Allocator>& y); // removed in C++20 4910b57cec5SDimitry Andric 4920b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 4930b57cec5SDimitry Andricbool 4940b57cec5SDimitry Andricoperator<=(const multiset<Key, Compare, Allocator>& x, 49506c3fb27SDimitry Andric const multiset<Key, Compare, Allocator>& y); // removed in C++20 49606c3fb27SDimitry Andric 49706c3fb27SDimitry Andrictemplate<class Key, class Compare, class Allocator> 49806c3fb27SDimitry Andric synth-three-way-result<Key> operator<=>(const multiset<Key, Compare, Allocator>& x, 49906c3fb27SDimitry Andric const multiset<Key, Compare, Allocator>& y); // since C++20 5000b57cec5SDimitry Andric 5010b57cec5SDimitry Andric// specialized algorithms: 5020b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator> 5030b57cec5SDimitry Andricvoid 5040b57cec5SDimitry Andricswap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y) 5050b57cec5SDimitry Andric noexcept(noexcept(x.swap(y))); 5060b57cec5SDimitry Andric 5070b57cec5SDimitry Andrictemplate <class Key, class Compare, class Allocator, class Predicate> 5085ffd83dbSDimitry Andrictypename multiset<Key, Compare, Allocator>::size_type 5095ffd83dbSDimitry Andricerase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 5100b57cec5SDimitry Andric 5110b57cec5SDimitry Andric} // std 5120b57cec5SDimitry Andric 5130b57cec5SDimitry Andric*/ 5140b57cec5SDimitry Andric 51581ad6265SDimitry Andric#include <__algorithm/equal.h> 51681ad6265SDimitry Andric#include <__algorithm/lexicographical_compare.h> 51706c3fb27SDimitry Andric#include <__algorithm/lexicographical_compare_three_way.h> 518*0fca6ea1SDimitry Andric#include <__assert> 5190b57cec5SDimitry Andric#include <__config> 520fe6060f1SDimitry Andric#include <__functional/is_transparent.h> 52181ad6265SDimitry Andric#include <__functional/operations.h> 52281ad6265SDimitry Andric#include <__iterator/erase_if_container.h> 523349cc55cSDimitry Andric#include <__iterator/iterator_traits.h> 52406c3fb27SDimitry Andric#include <__iterator/ranges_iterator_traits.h> 52581ad6265SDimitry Andric#include <__iterator/reverse_iterator.h> 526bdd1243dSDimitry Andric#include <__memory/allocator.h> 527bdd1243dSDimitry Andric#include <__memory_resource/polymorphic_allocator.h> 5280b57cec5SDimitry Andric#include <__node_handle> 52906c3fb27SDimitry Andric#include <__ranges/concepts.h> 53006c3fb27SDimitry Andric#include <__ranges/container_compatible_range.h> 53106c3fb27SDimitry Andric#include <__ranges/from_range.h> 532fe6060f1SDimitry Andric#include <__tree> 533bdd1243dSDimitry Andric#include <__type_traits/is_allocator.h> 534fe6060f1SDimitry Andric#include <__utility/forward.h> 5350b57cec5SDimitry Andric#include <version> 5360b57cec5SDimitry Andric 53781ad6265SDimitry Andric// standard-mandated includes 53881ad6265SDimitry Andric 53981ad6265SDimitry Andric// [iterator.range] 54081ad6265SDimitry Andric#include <__iterator/access.h> 54181ad6265SDimitry Andric#include <__iterator/data.h> 54281ad6265SDimitry Andric#include <__iterator/empty.h> 54381ad6265SDimitry Andric#include <__iterator/reverse_access.h> 54481ad6265SDimitry Andric#include <__iterator/size.h> 54581ad6265SDimitry Andric 54681ad6265SDimitry Andric// [associative.set.syn] 54781ad6265SDimitry Andric#include <compare> 54881ad6265SDimitry Andric#include <initializer_list> 54981ad6265SDimitry Andric 5500b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 5510b57cec5SDimitry Andric# pragma GCC system_header 5520b57cec5SDimitry Andric#endif 5530b57cec5SDimitry Andric 554b3edf446SDimitry Andric_LIBCPP_PUSH_MACROS 555b3edf446SDimitry Andric#include <__undef_macros> 556b3edf446SDimitry Andric 5570b57cec5SDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD 5580b57cec5SDimitry Andric 5590b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 5600b57cec5SDimitry Andricclass multiset; 5610b57cec5SDimitry Andric 562cb14a3feSDimitry Andrictemplate <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> > 563cb14a3feSDimitry Andricclass _LIBCPP_TEMPLATE_VIS set { 5640b57cec5SDimitry Andricpublic: 5650b57cec5SDimitry Andric // types: 5660b57cec5SDimitry Andric typedef _Key key_type; 5670b57cec5SDimitry Andric typedef key_type value_type; 56881ad6265SDimitry Andric typedef __type_identity_t<_Compare> key_compare; 5690b57cec5SDimitry Andric typedef key_compare value_compare; 57081ad6265SDimitry Andric typedef __type_identity_t<_Allocator> allocator_type; 5710b57cec5SDimitry Andric typedef value_type& reference; 5720b57cec5SDimitry Andric typedef const value_type& const_reference; 5730b57cec5SDimitry Andric 574*0fca6ea1SDimitry Andric static_assert(is_same<typename allocator_type::value_type, value_type>::value, 5750b57cec5SDimitry Andric "Allocator::value_type must be same type as value_type"); 5760b57cec5SDimitry Andric 5770b57cec5SDimitry Andricprivate: 5780b57cec5SDimitry Andric typedef __tree<value_type, value_compare, allocator_type> __base; 5790b57cec5SDimitry Andric typedef allocator_traits<allocator_type> __alloc_traits; 5800b57cec5SDimitry Andric 581*0fca6ea1SDimitry Andric static_assert(__check_valid_allocator<allocator_type>::value, ""); 582bdd1243dSDimitry Andric 5830b57cec5SDimitry Andric __base __tree_; 5840b57cec5SDimitry Andric 5850b57cec5SDimitry Andricpublic: 5860b57cec5SDimitry Andric typedef typename __base::pointer pointer; 5870b57cec5SDimitry Andric typedef typename __base::const_pointer const_pointer; 5880b57cec5SDimitry Andric typedef typename __base::size_type size_type; 5890b57cec5SDimitry Andric typedef typename __base::difference_type difference_type; 5900b57cec5SDimitry Andric typedef typename __base::const_iterator iterator; 5910b57cec5SDimitry Andric typedef typename __base::const_iterator const_iterator; 5925f757f3fSDimitry Andric typedef std::reverse_iterator<iterator> reverse_iterator; 5935f757f3fSDimitry Andric typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 5940b57cec5SDimitry Andric 59506c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 17 5960b57cec5SDimitry Andric typedef __set_node_handle<typename __base::__node, allocator_type> node_type; 5970b57cec5SDimitry Andric typedef __insert_return_type<iterator, node_type> insert_return_type; 5980b57cec5SDimitry Andric#endif 5990b57cec5SDimitry Andric 6000b57cec5SDimitry Andric template <class _Key2, class _Compare2, class _Alloc2> 6010b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS set; 6020b57cec5SDimitry Andric template <class _Key2, class _Compare2, class _Alloc2> 6030b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS multiset; 6040b57cec5SDimitry Andric 605cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set() _NOEXCEPT_( 606cb14a3feSDimitry Andric is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&& 6070b57cec5SDimitry Andric is_nothrow_copy_constructible<key_compare>::value) 6080b57cec5SDimitry Andric : __tree_(value_compare()) {} 6090b57cec5SDimitry Andric 610cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp) _NOEXCEPT_( 611cb14a3feSDimitry Andric is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value) 6120b57cec5SDimitry Andric : __tree_(__comp) {} 6130b57cec5SDimitry Andric 614cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {} 6150b57cec5SDimitry Andric template <class _InputIterator> 616cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare()) 617cb14a3feSDimitry Andric : __tree_(__comp) { 6180b57cec5SDimitry Andric insert(__f, __l); 6190b57cec5SDimitry Andric } 6200b57cec5SDimitry Andric 6210b57cec5SDimitry Andric template <class _InputIterator> 6225f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI 623cb14a3feSDimitry Andric set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a) 624cb14a3feSDimitry Andric : __tree_(__comp, __a) { 6250b57cec5SDimitry Andric insert(__f, __l); 6260b57cec5SDimitry Andric } 6270b57cec5SDimitry Andric 62806c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 23 62906c3fb27SDimitry Andric template <_ContainerCompatibleRange<value_type> _Range> 63006c3fb27SDimitry Andric _LIBCPP_HIDE_FROM_ABI 631cb14a3feSDimitry Andric set(from_range_t, 632cb14a3feSDimitry Andric _Range&& __range, 633cb14a3feSDimitry Andric const key_compare& __comp = key_compare(), 63406c3fb27SDimitry Andric const allocator_type& __a = allocator_type()) 63506c3fb27SDimitry Andric : __tree_(__comp, __a) { 63606c3fb27SDimitry Andric insert_range(std::forward<_Range>(__range)); 63706c3fb27SDimitry Andric } 63806c3fb27SDimitry Andric#endif 63906c3fb27SDimitry Andric 64006c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 6410b57cec5SDimitry Andric template <class _InputIterator> 642cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const allocator_type& __a) 6430b57cec5SDimitry Andric : set(__f, __l, key_compare(), __a) {} 6440b57cec5SDimitry Andric#endif 6450b57cec5SDimitry Andric 64606c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 23 64706c3fb27SDimitry Andric template <_ContainerCompatibleRange<value_type> _Range> 648cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set(from_range_t, _Range&& __range, const allocator_type& __a) 64906c3fb27SDimitry Andric : set(from_range, std::forward<_Range>(__range), key_compare(), __a) {} 65006c3fb27SDimitry Andric#endif 65106c3fb27SDimitry Andric 652cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set(const set& __s) : __tree_(__s.__tree_) { insert(__s.begin(), __s.end()); } 6530b57cec5SDimitry Andric 654cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set& operator=(const set& __s) { 6550b57cec5SDimitry Andric __tree_ = __s.__tree_; 6560b57cec5SDimitry Andric return *this; 6570b57cec5SDimitry Andric } 6580b57cec5SDimitry Andric 6590b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 660*0fca6ea1SDimitry Andric _LIBCPP_HIDE_FROM_ABI set(set&& __s) noexcept(is_nothrow_move_constructible<__base>::value) 6615f757f3fSDimitry Andric : __tree_(std::move(__s.__tree_)) {} 6620b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 6630b57cec5SDimitry Andric 664cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI explicit set(const allocator_type& __a) : __tree_(__a) {} 6650b57cec5SDimitry Andric 666cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set(const set& __s, const allocator_type& __a) : __tree_(__s.__tree_.value_comp(), __a) { 6670b57cec5SDimitry Andric insert(__s.begin(), __s.end()); 6680b57cec5SDimitry Andric } 6690b57cec5SDimitry Andric 6700b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 67106c3fb27SDimitry Andric _LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __a); 6720b57cec5SDimitry Andric 673cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) 674cb14a3feSDimitry Andric : __tree_(__comp) { 6750b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 6760b57cec5SDimitry Andric } 6770b57cec5SDimitry Andric 678cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a) 679cb14a3feSDimitry Andric : __tree_(__comp, __a) { 6800b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 6810b57cec5SDimitry Andric } 6820b57cec5SDimitry Andric 68306c3fb27SDimitry Andric# if _LIBCPP_STD_VER >= 14 684cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const allocator_type& __a) 6850b57cec5SDimitry Andric : set(__il, key_compare(), __a) {} 6860b57cec5SDimitry Andric# endif 6870b57cec5SDimitry Andric 688cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI set& operator=(initializer_list<value_type> __il) { 6890b57cec5SDimitry Andric __tree_.__assign_unique(__il.begin(), __il.end()); 6900b57cec5SDimitry Andric return *this; 6910b57cec5SDimitry Andric } 6920b57cec5SDimitry Andric 693*0fca6ea1SDimitry Andric _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) noexcept(is_nothrow_move_assignable<__base>::value) { 6945f757f3fSDimitry Andric __tree_ = std::move(__s.__tree_); 6950b57cec5SDimitry Andric return *this; 6960b57cec5SDimitry Andric } 6970b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 6980b57cec5SDimitry Andric 699cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); } 7000b57cec5SDimitry Andric 701cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); } 702cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); } 703cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); } 704cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); } 7050b57cec5SDimitry Andric 706cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); } 707cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); } 708cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); } 709cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); } 7100b57cec5SDimitry Andric 711cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); } 712cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); } 713cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); } 714cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); } 7150b57cec5SDimitry Andric 716*0fca6ea1SDimitry Andric _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } 717cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); } 718cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); } 7190b57cec5SDimitry Andric 7200b57cec5SDimitry Andric // modifiers: 7210b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 7220b57cec5SDimitry Andric template <class... _Args> 723cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) { 724cb14a3feSDimitry Andric return __tree_.__emplace_unique(std::forward<_Args>(__args)...); 725cb14a3feSDimitry Andric } 7260b57cec5SDimitry Andric template <class... _Args> 727cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) { 728cb14a3feSDimitry Andric return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...); 729cb14a3feSDimitry Andric } 7300b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 7310b57cec5SDimitry Andric 732cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__insert_unique(__v); } 733cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) { 734cb14a3feSDimitry Andric return __tree_.__insert_unique(__p, __v); 735cb14a3feSDimitry Andric } 7360b57cec5SDimitry Andric 7370b57cec5SDimitry Andric template <class _InputIterator> 738cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) { 7390b57cec5SDimitry Andric for (const_iterator __e = cend(); __f != __l; ++__f) 7400b57cec5SDimitry Andric __tree_.__insert_unique(__e, *__f); 7410b57cec5SDimitry Andric } 7420b57cec5SDimitry Andric 74306c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 23 74406c3fb27SDimitry Andric template <_ContainerCompatibleRange<value_type> _Range> 745cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) { 74606c3fb27SDimitry Andric const_iterator __end = cend(); 74706c3fb27SDimitry Andric for (auto&& __element : __range) { 74806c3fb27SDimitry Andric __tree_.__insert_unique(__end, std::forward<decltype(__element)>(__element)); 74906c3fb27SDimitry Andric } 75006c3fb27SDimitry Andric } 75106c3fb27SDimitry Andric#endif 75206c3fb27SDimitry Andric 7530b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 754cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) { 755cb14a3feSDimitry Andric return __tree_.__insert_unique(std::move(__v)); 756cb14a3feSDimitry Andric } 7570b57cec5SDimitry Andric 758cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) { 759cb14a3feSDimitry Andric return __tree_.__insert_unique(__p, std::move(__v)); 760cb14a3feSDimitry Andric } 7610b57cec5SDimitry Andric 762cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); } 7630b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 7640b57cec5SDimitry Andric 765cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); } 766cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); } 767cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); } 768cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); } 7690b57cec5SDimitry Andric 77006c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 17 771cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) { 7721db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), 7730b57cec5SDimitry Andric "node_type with incompatible allocator passed to set::insert()"); 774cb14a3feSDimitry Andric return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh)); 7750b57cec5SDimitry Andric } 776cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) { 7771db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), 7780b57cec5SDimitry Andric "node_type with incompatible allocator passed to set::insert()"); 779cb14a3feSDimitry Andric return __tree_.template __node_handle_insert_unique<node_type>(__hint, std::move(__nh)); 7800b57cec5SDimitry Andric } 781cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) { 7820b57cec5SDimitry Andric return __tree_.template __node_handle_extract<node_type>(__key); 7830b57cec5SDimitry Andric } 784cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) { 7850b57cec5SDimitry Andric return __tree_.template __node_handle_extract<node_type>(__it); 7860b57cec5SDimitry Andric } 7870b57cec5SDimitry Andric template <class _Compare2> 788cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) { 7891db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( 790cb14a3feSDimitry Andric __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); 7910b57cec5SDimitry Andric __tree_.__node_handle_merge_unique(__source.__tree_); 7920b57cec5SDimitry Andric } 7930b57cec5SDimitry Andric template <class _Compare2> 794cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) { 7951db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( 796cb14a3feSDimitry Andric __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); 7970b57cec5SDimitry Andric __tree_.__node_handle_merge_unique(__source.__tree_); 7980b57cec5SDimitry Andric } 7990b57cec5SDimitry Andric template <class _Compare2> 800cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) { 8011db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( 802cb14a3feSDimitry Andric __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); 8030b57cec5SDimitry Andric __tree_.__node_handle_merge_unique(__source.__tree_); 8040b57cec5SDimitry Andric } 8050b57cec5SDimitry Andric template <class _Compare2> 806cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) { 8071db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( 808cb14a3feSDimitry Andric __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); 8090b57cec5SDimitry Andric __tree_.__node_handle_merge_unique(__source.__tree_); 8100b57cec5SDimitry Andric } 8110b57cec5SDimitry Andric#endif 8120b57cec5SDimitry Andric 813*0fca6ea1SDimitry Andric _LIBCPP_HIDE_FROM_ABI void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__s.__tree_); } 8140b57cec5SDimitry Andric 815cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); } 816cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); } 817cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); } 8180b57cec5SDimitry Andric 8190b57cec5SDimitry Andric // set operations: 820cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); } 821cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); } 82206c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 823*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 824cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { 825cb14a3feSDimitry Andric return __tree_.find(__k); 826cb14a3feSDimitry Andric } 827*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 828cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { 829cb14a3feSDimitry Andric return __tree_.find(__k); 830cb14a3feSDimitry Andric } 8310b57cec5SDimitry Andric#endif 8320b57cec5SDimitry Andric 833cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_unique(__k); } 83406c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 835*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 836cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { 837cb14a3feSDimitry Andric return __tree_.__count_multi(__k); 838cb14a3feSDimitry Andric } 8390b57cec5SDimitry Andric#endif 8400b57cec5SDimitry Andric 84106c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 20 842cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } 843*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 844cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { 845cb14a3feSDimitry Andric return find(__k) != end(); 846cb14a3feSDimitry Andric } 84706c3fb27SDimitry Andric#endif // _LIBCPP_STD_VER >= 20 8480b57cec5SDimitry Andric 849cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); } 850cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); } 85106c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 852*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 853cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) { 854cb14a3feSDimitry Andric return __tree_.lower_bound(__k); 855cb14a3feSDimitry Andric } 8560b57cec5SDimitry Andric 857*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 858cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const { 859cb14a3feSDimitry Andric return __tree_.lower_bound(__k); 860cb14a3feSDimitry Andric } 8610b57cec5SDimitry Andric#endif 8620b57cec5SDimitry Andric 863cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); } 864cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); } 86506c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 866*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 867cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) { 868cb14a3feSDimitry Andric return __tree_.upper_bound(__k); 869cb14a3feSDimitry Andric } 870*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 871cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const { 872cb14a3feSDimitry Andric return __tree_.upper_bound(__k); 873cb14a3feSDimitry Andric } 8740b57cec5SDimitry Andric#endif 8750b57cec5SDimitry Andric 876cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) { 877cb14a3feSDimitry Andric return __tree_.__equal_range_unique(__k); 878cb14a3feSDimitry Andric } 879cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const { 880cb14a3feSDimitry Andric return __tree_.__equal_range_unique(__k); 881cb14a3feSDimitry Andric } 88206c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 883*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 884cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { 885cb14a3feSDimitry Andric return __tree_.__equal_range_multi(__k); 886cb14a3feSDimitry Andric } 887*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 888cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { 889cb14a3feSDimitry Andric return __tree_.__equal_range_multi(__k); 890cb14a3feSDimitry Andric } 8910b57cec5SDimitry Andric#endif 8920b57cec5SDimitry Andric}; 8930b57cec5SDimitry Andric 894349cc55cSDimitry Andric#if _LIBCPP_STD_VER >= 17 8950b57cec5SDimitry Andrictemplate <class _InputIterator, 896fe6060f1SDimitry Andric class _Compare = less<__iter_value_type<_InputIterator>>, 897fe6060f1SDimitry Andric class _Allocator = allocator<__iter_value_type<_InputIterator>>, 89806c3fb27SDimitry Andric class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>, 899349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value, void>, 900349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Compare>::value, void>> 9010b57cec5SDimitry Andricset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) 902fe6060f1SDimitry Andric -> set<__iter_value_type<_InputIterator>, _Compare, _Allocator>; 9030b57cec5SDimitry Andric 90406c3fb27SDimitry Andric# if _LIBCPP_STD_VER >= 23 905cb14a3feSDimitry Andrictemplate <ranges::input_range _Range, 906cb14a3feSDimitry Andric class _Compare = less<ranges::range_value_t<_Range>>, 90706c3fb27SDimitry Andric class _Allocator = allocator<ranges::range_value_t<_Range>>, 90806c3fb27SDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value, void>, 90906c3fb27SDimitry Andric class = enable_if_t<!__is_allocator<_Compare>::value, void>> 91006c3fb27SDimitry Andricset(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator()) 91106c3fb27SDimitry Andric -> set<ranges::range_value_t<_Range>, _Compare, _Allocator>; 91206c3fb27SDimitry Andric# endif 91306c3fb27SDimitry Andric 914cb14a3feSDimitry Andrictemplate <class _Key, 915cb14a3feSDimitry Andric class _Compare = less<_Key>, 9160b57cec5SDimitry Andric class _Allocator = allocator<_Key>, 917349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Compare>::value, void>, 918349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value, void>> 919cb14a3feSDimitry Andricset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator()) -> set<_Key, _Compare, _Allocator>; 9200b57cec5SDimitry Andric 921cb14a3feSDimitry Andrictemplate <class _InputIterator, 922cb14a3feSDimitry Andric class _Allocator, 92306c3fb27SDimitry Andric class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>, 924349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value, void>> 925*0fca6ea1SDimitry Andricset(_InputIterator, 926*0fca6ea1SDimitry Andric _InputIterator, 927*0fca6ea1SDimitry Andric _Allocator) -> set<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>; 9280b57cec5SDimitry Andric 92906c3fb27SDimitry Andric# if _LIBCPP_STD_VER >= 23 930cb14a3feSDimitry Andrictemplate <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>> 931*0fca6ea1SDimitry Andricset(from_range_t, 932*0fca6ea1SDimitry Andric _Range&&, 933*0fca6ea1SDimitry Andric _Allocator) -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>; 93406c3fb27SDimitry Andric# endif 93506c3fb27SDimitry Andric 936cb14a3feSDimitry Andrictemplate <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>> 937cb14a3feSDimitry Andricset(initializer_list<_Key>, _Allocator) -> set<_Key, less<_Key>, _Allocator>; 9380b57cec5SDimitry Andric#endif 9390b57cec5SDimitry Andric 9400b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 9410b57cec5SDimitry Andric 9420b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 943cb14a3feSDimitry Andricset<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) : __tree_(std::move(__s.__tree_), __a) { 944cb14a3feSDimitry Andric if (__a != __s.get_allocator()) { 9450b57cec5SDimitry Andric const_iterator __e = cend(); 9460b57cec5SDimitry Andric while (!__s.empty()) 9475f757f3fSDimitry Andric insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_)); 9480b57cec5SDimitry Andric } 9490b57cec5SDimitry Andric} 9500b57cec5SDimitry Andric 9510b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 9520b57cec5SDimitry Andric 9530b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 954cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 955cb14a3feSDimitry Andricoperator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { 9565f757f3fSDimitry Andric return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); 9570b57cec5SDimitry Andric} 9580b57cec5SDimitry Andric 95906c3fb27SDimitry Andric#if _LIBCPP_STD_VER <= 17 96006c3fb27SDimitry Andric 9610b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 962cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 963cb14a3feSDimitry Andricoperator<(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { 9645f757f3fSDimitry Andric return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); 9650b57cec5SDimitry Andric} 9660b57cec5SDimitry Andric 9670b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 968cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 969cb14a3feSDimitry Andricoperator!=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { 9700b57cec5SDimitry Andric return !(__x == __y); 9710b57cec5SDimitry Andric} 9720b57cec5SDimitry Andric 9730b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 974cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 975cb14a3feSDimitry Andricoperator>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { 9760b57cec5SDimitry Andric return __y < __x; 9770b57cec5SDimitry Andric} 9780b57cec5SDimitry Andric 9790b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 980cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 981cb14a3feSDimitry Andricoperator>=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { 9820b57cec5SDimitry Andric return !(__x < __y); 9830b57cec5SDimitry Andric} 9840b57cec5SDimitry Andric 9850b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 986cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 987cb14a3feSDimitry Andricoperator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { 9880b57cec5SDimitry Andric return !(__y < __x); 9890b57cec5SDimitry Andric} 9900b57cec5SDimitry Andric 99106c3fb27SDimitry Andric#else // _LIBCPP_STD_VER <= 17 99206c3fb27SDimitry Andric 99306c3fb27SDimitry Andrictemplate <class _Key, class _Allocator> 99406c3fb27SDimitry Andric_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key> 99506c3fb27SDimitry Andricoperator<=>(const set<_Key, _Allocator>& __x, const set<_Key, _Allocator>& __y) { 996*0fca6ea1SDimitry Andric return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); 99706c3fb27SDimitry Andric} 99806c3fb27SDimitry Andric 99906c3fb27SDimitry Andric#endif // _LIBCPP_STD_VER <= 17 100006c3fb27SDimitry Andric 10010b57cec5SDimitry Andric// specialized algorithms: 10020b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 1003cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI void swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y) 1004cb14a3feSDimitry Andric _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { 10050b57cec5SDimitry Andric __x.swap(__y); 10060b57cec5SDimitry Andric} 10070b57cec5SDimitry Andric 100806c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 20 10090b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator, class _Predicate> 1010cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI typename set<_Key, _Compare, _Allocator>::size_type 10115ffd83dbSDimitry Andricerase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) { 10125f757f3fSDimitry Andric return std::__libcpp_erase_if_container(__c, __pred); 10135ffd83dbSDimitry Andric} 10140b57cec5SDimitry Andric#endif 10150b57cec5SDimitry Andric 1016cb14a3feSDimitry Andrictemplate <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> > 1017cb14a3feSDimitry Andricclass _LIBCPP_TEMPLATE_VIS multiset { 10180b57cec5SDimitry Andricpublic: 10190b57cec5SDimitry Andric // types: 10200b57cec5SDimitry Andric typedef _Key key_type; 10210b57cec5SDimitry Andric typedef key_type value_type; 102281ad6265SDimitry Andric typedef __type_identity_t<_Compare> key_compare; 10230b57cec5SDimitry Andric typedef key_compare value_compare; 102481ad6265SDimitry Andric typedef __type_identity_t<_Allocator> allocator_type; 10250b57cec5SDimitry Andric typedef value_type& reference; 10260b57cec5SDimitry Andric typedef const value_type& const_reference; 10270b57cec5SDimitry Andric 1028*0fca6ea1SDimitry Andric static_assert(is_same<typename allocator_type::value_type, value_type>::value, 10290b57cec5SDimitry Andric "Allocator::value_type must be same type as value_type"); 10300b57cec5SDimitry Andric 10310b57cec5SDimitry Andricprivate: 10320b57cec5SDimitry Andric typedef __tree<value_type, value_compare, allocator_type> __base; 10330b57cec5SDimitry Andric typedef allocator_traits<allocator_type> __alloc_traits; 10340b57cec5SDimitry Andric 1035*0fca6ea1SDimitry Andric static_assert(__check_valid_allocator<allocator_type>::value, ""); 1036bdd1243dSDimitry Andric 10370b57cec5SDimitry Andric __base __tree_; 10380b57cec5SDimitry Andric 10390b57cec5SDimitry Andricpublic: 10400b57cec5SDimitry Andric typedef typename __base::pointer pointer; 10410b57cec5SDimitry Andric typedef typename __base::const_pointer const_pointer; 10420b57cec5SDimitry Andric typedef typename __base::size_type size_type; 10430b57cec5SDimitry Andric typedef typename __base::difference_type difference_type; 10440b57cec5SDimitry Andric typedef typename __base::const_iterator iterator; 10450b57cec5SDimitry Andric typedef typename __base::const_iterator const_iterator; 10465f757f3fSDimitry Andric typedef std::reverse_iterator<iterator> reverse_iterator; 10475f757f3fSDimitry Andric typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 10480b57cec5SDimitry Andric 104906c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 17 10500b57cec5SDimitry Andric typedef __set_node_handle<typename __base::__node, allocator_type> node_type; 10510b57cec5SDimitry Andric#endif 10520b57cec5SDimitry Andric 10530b57cec5SDimitry Andric template <class _Key2, class _Compare2, class _Alloc2> 10540b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS set; 10550b57cec5SDimitry Andric template <class _Key2, class _Compare2, class _Alloc2> 10560b57cec5SDimitry Andric friend class _LIBCPP_TEMPLATE_VIS multiset; 10570b57cec5SDimitry Andric 10580b57cec5SDimitry Andric // construct/copy/destroy: 1059cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset() _NOEXCEPT_( 1060cb14a3feSDimitry Andric is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&& 10610b57cec5SDimitry Andric is_nothrow_copy_constructible<key_compare>::value) 10620b57cec5SDimitry Andric : __tree_(value_compare()) {} 10630b57cec5SDimitry Andric 1064cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp) _NOEXCEPT_( 1065cb14a3feSDimitry Andric is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value) 10660b57cec5SDimitry Andric : __tree_(__comp) {} 10670b57cec5SDimitry Andric 1068cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp, const allocator_type& __a) 10690b57cec5SDimitry Andric : __tree_(__comp, __a) {} 10700b57cec5SDimitry Andric template <class _InputIterator> 1071cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare()) 1072cb14a3feSDimitry Andric : __tree_(__comp) { 10730b57cec5SDimitry Andric insert(__f, __l); 10740b57cec5SDimitry Andric } 10750b57cec5SDimitry Andric 107606c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 10770b57cec5SDimitry Andric template <class _InputIterator> 1078cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a) 10790b57cec5SDimitry Andric : multiset(__f, __l, key_compare(), __a) {} 10800b57cec5SDimitry Andric#endif 10810b57cec5SDimitry Andric 10820b57cec5SDimitry Andric template <class _InputIterator> 10835f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI 1084cb14a3feSDimitry Andric multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a) 1085cb14a3feSDimitry Andric : __tree_(__comp, __a) { 10860b57cec5SDimitry Andric insert(__f, __l); 10870b57cec5SDimitry Andric } 10880b57cec5SDimitry Andric 108906c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 23 109006c3fb27SDimitry Andric template <_ContainerCompatibleRange<value_type> _Range> 109106c3fb27SDimitry Andric _LIBCPP_HIDE_FROM_ABI 1092cb14a3feSDimitry Andric multiset(from_range_t, 1093cb14a3feSDimitry Andric _Range&& __range, 1094cb14a3feSDimitry Andric const key_compare& __comp = key_compare(), 109506c3fb27SDimitry Andric const allocator_type& __a = allocator_type()) 109606c3fb27SDimitry Andric : __tree_(__comp, __a) { 109706c3fb27SDimitry Andric insert_range(std::forward<_Range>(__range)); 109806c3fb27SDimitry Andric } 109906c3fb27SDimitry Andric 110006c3fb27SDimitry Andric template <_ContainerCompatibleRange<value_type> _Range> 1101cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset(from_range_t, _Range&& __range, const allocator_type& __a) 110206c3fb27SDimitry Andric : multiset(from_range, std::forward<_Range>(__range), key_compare(), __a) {} 110306c3fb27SDimitry Andric#endif 110406c3fb27SDimitry Andric 1105cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s) 11060b57cec5SDimitry Andric : __tree_(__s.__tree_.value_comp(), 1107cb14a3feSDimitry Andric __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc())) { 11080b57cec5SDimitry Andric insert(__s.begin(), __s.end()); 11090b57cec5SDimitry Andric } 11100b57cec5SDimitry Andric 1111cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset& operator=(const multiset& __s) { 11120b57cec5SDimitry Andric __tree_ = __s.__tree_; 11130b57cec5SDimitry Andric return *this; 11140b57cec5SDimitry Andric } 11150b57cec5SDimitry Andric 11160b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 1117*0fca6ea1SDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) noexcept(is_nothrow_move_constructible<__base>::value) 11185f757f3fSDimitry Andric : __tree_(std::move(__s.__tree_)) {} 11190b57cec5SDimitry Andric 112006c3fb27SDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a); 11210b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 1122cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI explicit multiset(const allocator_type& __a) : __tree_(__a) {} 1123cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s, const allocator_type& __a) 1124cb14a3feSDimitry Andric : __tree_(__s.__tree_.value_comp(), __a) { 11250b57cec5SDimitry Andric insert(__s.begin(), __s.end()); 11260b57cec5SDimitry Andric } 11270b57cec5SDimitry Andric 11280b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 1129cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) 1130cb14a3feSDimitry Andric : __tree_(__comp) { 11310b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 11320b57cec5SDimitry Andric } 11330b57cec5SDimitry Andric 11345f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI 1135cb14a3feSDimitry Andric multiset(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a) 1136cb14a3feSDimitry Andric : __tree_(__comp, __a) { 11370b57cec5SDimitry Andric insert(__il.begin(), __il.end()); 11380b57cec5SDimitry Andric } 11390b57cec5SDimitry Andric 114006c3fb27SDimitry Andric# if _LIBCPP_STD_VER >= 14 1141cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const allocator_type& __a) 11420b57cec5SDimitry Andric : multiset(__il, key_compare(), __a) {} 11430b57cec5SDimitry Andric# endif 11440b57cec5SDimitry Andric 1145cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset& operator=(initializer_list<value_type> __il) { 11460b57cec5SDimitry Andric __tree_.__assign_multi(__il.begin(), __il.end()); 11470b57cec5SDimitry Andric return *this; 11480b57cec5SDimitry Andric } 11490b57cec5SDimitry Andric 1150cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI multiset& operator=(multiset&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) { 11515f757f3fSDimitry Andric __tree_ = std::move(__s.__tree_); 11520b57cec5SDimitry Andric return *this; 11530b57cec5SDimitry Andric } 11540b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 11550b57cec5SDimitry Andric 1156cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI ~multiset() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); } 11570b57cec5SDimitry Andric 1158cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); } 1159cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); } 1160cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); } 1161cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); } 11620b57cec5SDimitry Andric 1163cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); } 1164cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(end()); } 1165cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); } 1166cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(begin()); } 11670b57cec5SDimitry Andric 1168cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); } 1169cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); } 1170cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); } 1171cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); } 11720b57cec5SDimitry Andric 1173*0fca6ea1SDimitry Andric _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; } 1174cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); } 1175cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); } 11760b57cec5SDimitry Andric 11770b57cec5SDimitry Andric // modifiers: 11780b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 11790b57cec5SDimitry Andric template <class... _Args> 1180cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) { 1181cb14a3feSDimitry Andric return __tree_.__emplace_multi(std::forward<_Args>(__args)...); 1182cb14a3feSDimitry Andric } 11830b57cec5SDimitry Andric template <class... _Args> 1184cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) { 1185cb14a3feSDimitry Andric return __tree_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...); 1186cb14a3feSDimitry Andric } 11870b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 11880b57cec5SDimitry Andric 1189cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__insert_multi(__v); } 1190cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) { 1191cb14a3feSDimitry Andric return __tree_.__insert_multi(__p, __v); 1192cb14a3feSDimitry Andric } 11930b57cec5SDimitry Andric 11940b57cec5SDimitry Andric template <class _InputIterator> 1195cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) { 11960b57cec5SDimitry Andric for (const_iterator __e = cend(); __f != __l; ++__f) 11970b57cec5SDimitry Andric __tree_.__insert_multi(__e, *__f); 11980b57cec5SDimitry Andric } 11990b57cec5SDimitry Andric 120006c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 23 120106c3fb27SDimitry Andric template <_ContainerCompatibleRange<value_type> _Range> 1202cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) { 120306c3fb27SDimitry Andric const_iterator __end = cend(); 120406c3fb27SDimitry Andric for (auto&& __element : __range) { 120506c3fb27SDimitry Andric __tree_.__insert_multi(__end, std::forward<decltype(__element)>(__element)); 120606c3fb27SDimitry Andric } 120706c3fb27SDimitry Andric } 120806c3fb27SDimitry Andric#endif 120906c3fb27SDimitry Andric 12100b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 1211cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__insert_multi(std::move(__v)); } 12120b57cec5SDimitry Andric 1213cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) { 1214cb14a3feSDimitry Andric return __tree_.__insert_multi(__p, std::move(__v)); 1215cb14a3feSDimitry Andric } 12160b57cec5SDimitry Andric 1217cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); } 12180b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 12190b57cec5SDimitry Andric 1220cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); } 1221cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); } 1222cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); } 1223cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); } 12240b57cec5SDimitry Andric 122506c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 17 1226cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) { 12271db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), 12280b57cec5SDimitry Andric "node_type with incompatible allocator passed to multiset::insert()"); 1229cb14a3feSDimitry Andric return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh)); 12300b57cec5SDimitry Andric } 1231cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) { 12321db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(), 12330b57cec5SDimitry Andric "node_type with incompatible allocator passed to multiset::insert()"); 1234cb14a3feSDimitry Andric return __tree_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh)); 12350b57cec5SDimitry Andric } 1236cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) { 12370b57cec5SDimitry Andric return __tree_.template __node_handle_extract<node_type>(__key); 12380b57cec5SDimitry Andric } 1239cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) { 12400b57cec5SDimitry Andric return __tree_.template __node_handle_extract<node_type>(__it); 12410b57cec5SDimitry Andric } 12420b57cec5SDimitry Andric template <class _Compare2> 1243cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) { 12441db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( 1245cb14a3feSDimitry Andric __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); 12460b57cec5SDimitry Andric __tree_.__node_handle_merge_multi(__source.__tree_); 12470b57cec5SDimitry Andric } 12480b57cec5SDimitry Andric template <class _Compare2> 1249cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) { 12501db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( 1251cb14a3feSDimitry Andric __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); 12520b57cec5SDimitry Andric __tree_.__node_handle_merge_multi(__source.__tree_); 12530b57cec5SDimitry Andric } 12540b57cec5SDimitry Andric template <class _Compare2> 1255cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) { 12561db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( 1257cb14a3feSDimitry Andric __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); 12580b57cec5SDimitry Andric __tree_.__node_handle_merge_multi(__source.__tree_); 12590b57cec5SDimitry Andric } 12600b57cec5SDimitry Andric template <class _Compare2> 1261cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) { 12621db9f3b2SDimitry Andric _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( 1263cb14a3feSDimitry Andric __source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); 12640b57cec5SDimitry Andric __tree_.__node_handle_merge_multi(__source.__tree_); 12650b57cec5SDimitry Andric } 12660b57cec5SDimitry Andric#endif 12670b57cec5SDimitry Andric 1268*0fca6ea1SDimitry Andric _LIBCPP_HIDE_FROM_ABI void swap(multiset& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { 1269cb14a3feSDimitry Andric __tree_.swap(__s.__tree_); 1270cb14a3feSDimitry Andric } 12710b57cec5SDimitry Andric 1272cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); } 1273cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); } 1274cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); } 12750b57cec5SDimitry Andric 12760b57cec5SDimitry Andric // set operations: 1277cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); } 1278cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); } 127906c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 1280*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 1281cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { 1282cb14a3feSDimitry Andric return __tree_.find(__k); 1283cb14a3feSDimitry Andric } 1284*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 1285cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { 1286cb14a3feSDimitry Andric return __tree_.find(__k); 1287cb14a3feSDimitry Andric } 12880b57cec5SDimitry Andric#endif 12890b57cec5SDimitry Andric 1290cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const { return __tree_.__count_multi(__k); } 129106c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 1292*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 1293cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { 1294cb14a3feSDimitry Andric return __tree_.__count_multi(__k); 1295cb14a3feSDimitry Andric } 12960b57cec5SDimitry Andric#endif 12970b57cec5SDimitry Andric 129806c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 20 1299cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } 1300*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 1301cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { 1302cb14a3feSDimitry Andric return find(__k) != end(); 1303cb14a3feSDimitry Andric } 130406c3fb27SDimitry Andric#endif // _LIBCPP_STD_VER >= 20 13050b57cec5SDimitry Andric 1306cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) { return __tree_.lower_bound(__k); } 1307cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const { return __tree_.lower_bound(__k); } 130806c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 1309*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 1310cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) { 1311cb14a3feSDimitry Andric return __tree_.lower_bound(__k); 1312cb14a3feSDimitry Andric } 13130b57cec5SDimitry Andric 1314*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 1315cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const { 1316cb14a3feSDimitry Andric return __tree_.lower_bound(__k); 1317cb14a3feSDimitry Andric } 13180b57cec5SDimitry Andric#endif 13190b57cec5SDimitry Andric 1320cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) { return __tree_.upper_bound(__k); } 1321cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const { return __tree_.upper_bound(__k); } 132206c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 1323*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 1324cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) { 1325cb14a3feSDimitry Andric return __tree_.upper_bound(__k); 1326cb14a3feSDimitry Andric } 1327*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 1328cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const { 1329cb14a3feSDimitry Andric return __tree_.upper_bound(__k); 1330cb14a3feSDimitry Andric } 13310b57cec5SDimitry Andric#endif 13320b57cec5SDimitry Andric 1333cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) { 1334cb14a3feSDimitry Andric return __tree_.__equal_range_multi(__k); 1335cb14a3feSDimitry Andric } 1336cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const { 1337cb14a3feSDimitry Andric return __tree_.__equal_range_multi(__k); 1338cb14a3feSDimitry Andric } 133906c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 14 1340*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 1341cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) { 1342cb14a3feSDimitry Andric return __tree_.__equal_range_multi(__k); 1343cb14a3feSDimitry Andric } 1344*0fca6ea1SDimitry Andric template <typename _K2, enable_if_t<__is_transparent_v<_Compare, _K2>, int> = 0> 1345cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const { 1346cb14a3feSDimitry Andric return __tree_.__equal_range_multi(__k); 1347cb14a3feSDimitry Andric } 13480b57cec5SDimitry Andric#endif 13490b57cec5SDimitry Andric}; 13500b57cec5SDimitry Andric 1351349cc55cSDimitry Andric#if _LIBCPP_STD_VER >= 17 13520b57cec5SDimitry Andrictemplate <class _InputIterator, 1353fe6060f1SDimitry Andric class _Compare = less<__iter_value_type<_InputIterator>>, 1354fe6060f1SDimitry Andric class _Allocator = allocator<__iter_value_type<_InputIterator>>, 135506c3fb27SDimitry Andric class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>, 1356349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value, void>, 1357349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Compare>::value, void>> 13580b57cec5SDimitry Andricmultiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) 1359fe6060f1SDimitry Andric -> multiset<__iter_value_type<_InputIterator>, _Compare, _Allocator>; 13600b57cec5SDimitry Andric 136106c3fb27SDimitry Andric# if _LIBCPP_STD_VER >= 23 1362cb14a3feSDimitry Andrictemplate <ranges::input_range _Range, 1363cb14a3feSDimitry Andric class _Compare = less<ranges::range_value_t<_Range>>, 136406c3fb27SDimitry Andric class _Allocator = allocator<ranges::range_value_t<_Range>>, 136506c3fb27SDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value, void>, 136606c3fb27SDimitry Andric class = enable_if_t<!__is_allocator<_Compare>::value, void>> 136706c3fb27SDimitry Andricmultiset(from_range_t, _Range&&, _Compare = _Compare(), _Allocator = _Allocator()) 136806c3fb27SDimitry Andric -> multiset<ranges::range_value_t<_Range>, _Compare, _Allocator>; 136906c3fb27SDimitry Andric# endif 137006c3fb27SDimitry Andric 1371cb14a3feSDimitry Andrictemplate <class _Key, 1372cb14a3feSDimitry Andric class _Compare = less<_Key>, 13730b57cec5SDimitry Andric class _Allocator = allocator<_Key>, 1374349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value, void>, 1375349cc55cSDimitry Andric class = enable_if_t<!__is_allocator<_Compare>::value, void>> 1376*0fca6ea1SDimitry Andricmultiset(initializer_list<_Key>, 1377*0fca6ea1SDimitry Andric _Compare = _Compare(), 1378*0fca6ea1SDimitry Andric _Allocator = _Allocator()) -> multiset<_Key, _Compare, _Allocator>; 13790b57cec5SDimitry Andric 1380cb14a3feSDimitry Andrictemplate <class _InputIterator, 1381cb14a3feSDimitry Andric class _Allocator, 138206c3fb27SDimitry Andric class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>, 1383349cc55cSDimitry Andric class = enable_if_t<__is_allocator<_Allocator>::value, void>> 13840b57cec5SDimitry Andricmultiset(_InputIterator, _InputIterator, _Allocator) 1385cb14a3feSDimitry Andric -> multiset<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>; 13860b57cec5SDimitry Andric 138706c3fb27SDimitry Andric# if _LIBCPP_STD_VER >= 23 1388cb14a3feSDimitry Andrictemplate <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>> 1389*0fca6ea1SDimitry Andricmultiset(from_range_t, 1390*0fca6ea1SDimitry Andric _Range&&, 1391*0fca6ea1SDimitry Andric _Allocator) -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>; 139206c3fb27SDimitry Andric# endif 139306c3fb27SDimitry Andric 1394cb14a3feSDimitry Andrictemplate <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>> 1395cb14a3feSDimitry Andricmultiset(initializer_list<_Key>, _Allocator) -> multiset<_Key, less<_Key>, _Allocator>; 13960b57cec5SDimitry Andric#endif 13970b57cec5SDimitry Andric 13980b57cec5SDimitry Andric#ifndef _LIBCPP_CXX03_LANG 13990b57cec5SDimitry Andric 14000b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 14010b57cec5SDimitry Andricmultiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) 1402cb14a3feSDimitry Andric : __tree_(std::move(__s.__tree_), __a) { 1403cb14a3feSDimitry Andric if (__a != __s.get_allocator()) { 14040b57cec5SDimitry Andric const_iterator __e = cend(); 14050b57cec5SDimitry Andric while (!__s.empty()) 14065f757f3fSDimitry Andric insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_)); 14070b57cec5SDimitry Andric } 14080b57cec5SDimitry Andric} 14090b57cec5SDimitry Andric 14100b57cec5SDimitry Andric#endif // _LIBCPP_CXX03_LANG 14110b57cec5SDimitry Andric 14120b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 1413cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 1414cb14a3feSDimitry Andricoperator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { 14155f757f3fSDimitry Andric return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); 14160b57cec5SDimitry Andric} 14170b57cec5SDimitry Andric 141806c3fb27SDimitry Andric#if _LIBCPP_STD_VER <= 17 141906c3fb27SDimitry Andric 14200b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 1421cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 1422cb14a3feSDimitry Andricoperator<(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { 14235f757f3fSDimitry Andric return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); 14240b57cec5SDimitry Andric} 14250b57cec5SDimitry Andric 14260b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 1427cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 1428cb14a3feSDimitry Andricoperator!=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { 14290b57cec5SDimitry Andric return !(__x == __y); 14300b57cec5SDimitry Andric} 14310b57cec5SDimitry Andric 14320b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 1433cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 1434cb14a3feSDimitry Andricoperator>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { 14350b57cec5SDimitry Andric return __y < __x; 14360b57cec5SDimitry Andric} 14370b57cec5SDimitry Andric 14380b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 1439cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 1440cb14a3feSDimitry Andricoperator>=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { 14410b57cec5SDimitry Andric return !(__x < __y); 14420b57cec5SDimitry Andric} 14430b57cec5SDimitry Andric 14440b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 1445cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI bool 1446cb14a3feSDimitry Andricoperator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { 14470b57cec5SDimitry Andric return !(__y < __x); 14480b57cec5SDimitry Andric} 14490b57cec5SDimitry Andric 145006c3fb27SDimitry Andric#else // _LIBCPP_STD_VER <= 17 145106c3fb27SDimitry Andric 145206c3fb27SDimitry Andrictemplate <class _Key, class _Allocator> 145306c3fb27SDimitry Andric_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key> 145406c3fb27SDimitry Andricoperator<=>(const multiset<_Key, _Allocator>& __x, const multiset<_Key, _Allocator>& __y) { 145506c3fb27SDimitry Andric return std::lexicographical_compare_three_way( 1456*0fca6ea1SDimitry Andric __x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way); 145706c3fb27SDimitry Andric} 145806c3fb27SDimitry Andric 145906c3fb27SDimitry Andric#endif // _LIBCPP_STD_VER <= 17 146006c3fb27SDimitry Andric 14610b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator> 1462cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI void 1463cb14a3feSDimitry Andricswap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y) 1464cb14a3feSDimitry Andric _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { 14650b57cec5SDimitry Andric __x.swap(__y); 14660b57cec5SDimitry Andric} 14670b57cec5SDimitry Andric 146806c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 20 14690b57cec5SDimitry Andrictemplate <class _Key, class _Compare, class _Allocator, class _Predicate> 1470cb14a3feSDimitry Andricinline _LIBCPP_HIDE_FROM_ABI typename multiset<_Key, _Compare, _Allocator>::size_type 14715ffd83dbSDimitry Andricerase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) { 14725f757f3fSDimitry Andric return std::__libcpp_erase_if_container(__c, __pred); 14735ffd83dbSDimitry Andric} 14740b57cec5SDimitry Andric#endif 14750b57cec5SDimitry Andric 14760b57cec5SDimitry Andric_LIBCPP_END_NAMESPACE_STD 14770b57cec5SDimitry Andric 147806c3fb27SDimitry Andric#if _LIBCPP_STD_VER >= 17 1479bdd1243dSDimitry Andric_LIBCPP_BEGIN_NAMESPACE_STD 1480bdd1243dSDimitry Andricnamespace pmr { 1481bdd1243dSDimitry Andrictemplate <class _KeyT, class _CompareT = std::less<_KeyT>> 148206c3fb27SDimitry Andricusing set _LIBCPP_AVAILABILITY_PMR = std::set<_KeyT, _CompareT, polymorphic_allocator<_KeyT>>; 1483bdd1243dSDimitry Andric 1484bdd1243dSDimitry Andrictemplate <class _KeyT, class _CompareT = std::less<_KeyT>> 148506c3fb27SDimitry Andricusing multiset _LIBCPP_AVAILABILITY_PMR = std::multiset<_KeyT, _CompareT, polymorphic_allocator<_KeyT>>; 1486bdd1243dSDimitry Andric} // namespace pmr 1487bdd1243dSDimitry Andric_LIBCPP_END_NAMESPACE_STD 1488bdd1243dSDimitry Andric#endif 1489bdd1243dSDimitry Andric 1490b3edf446SDimitry Andric_LIBCPP_POP_MACROS 1491b3edf446SDimitry Andric 1492bdd1243dSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 1493bdd1243dSDimitry Andric# include <concepts> 149406c3fb27SDimitry Andric# include <cstdlib> 1495bdd1243dSDimitry Andric# include <functional> 1496bdd1243dSDimitry Andric# include <iterator> 14975f757f3fSDimitry Andric# include <stdexcept> 149806c3fb27SDimitry Andric# include <type_traits> 1499bdd1243dSDimitry Andric#endif 1500bdd1243dSDimitry Andric 15010b57cec5SDimitry Andric#endif // _LIBCPP_SET 1502