Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===---------------------------- set -------------------------------------===// |
| 3 | // |
Howard Hinnant | c566dc3 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
Howard Hinnant | ee11c31 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 6 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_SET |
| 12 | #define _LIBCPP_SET |
| 13 | |
| 14 | /* |
| 15 | |
| 16 | set synopsis |
| 17 | |
| 18 | namespace std |
| 19 | { |
| 20 | |
| 21 | template <class Key, class Compare = less<Key>, |
| 22 | class Allocator = allocator<Key>> |
| 23 | class set |
| 24 | { |
| 25 | public: |
| 26 | // types: |
| 27 | typedef Key key_type; |
| 28 | typedef key_type value_type; |
| 29 | typedef Compare key_compare; |
| 30 | typedef key_compare value_compare; |
| 31 | typedef Allocator allocator_type; |
| 32 | typedef typename allocator_type::reference reference; |
| 33 | typedef typename allocator_type::const_reference const_reference; |
| 34 | typedef typename allocator_type::size_type size_type; |
| 35 | typedef typename allocator_type::difference_type difference_type; |
| 36 | typedef typename allocator_type::pointer pointer; |
| 37 | typedef typename allocator_type::const_pointer const_pointer; |
| 38 | |
| 39 | typedef implementation-defined iterator; |
| 40 | typedef implementation-defined const_iterator; |
| 41 | typedef std::reverse_iterator<iterator> reverse_iterator; |
| 42 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 43 | typedef unspecified node_type; // C++17 |
| 44 | typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++17 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 45 | |
| 46 | // construct/copy/destroy: |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 47 | set() |
| 48 | noexcept( |
| 49 | is_nothrow_default_constructible<allocator_type>::value && |
| 50 | is_nothrow_default_constructible<key_compare>::value && |
| 51 | is_nothrow_copy_constructible<key_compare>::value); |
| 52 | explicit set(const value_compare& comp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 53 | set(const value_compare& comp, const allocator_type& a); |
| 54 | template <class InputIterator> |
| 55 | set(InputIterator first, InputIterator last, |
| 56 | const value_compare& comp = value_compare()); |
| 57 | template <class InputIterator> |
| 58 | set(InputIterator first, InputIterator last, const value_compare& comp, |
| 59 | const allocator_type& a); |
| 60 | set(const set& s); |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 61 | set(set&& s) |
| 62 | noexcept( |
| 63 | is_nothrow_move_constructible<allocator_type>::value && |
| 64 | is_nothrow_move_constructible<key_compare>::value); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 65 | explicit set(const allocator_type& a); |
| 66 | set(const set& s, const allocator_type& a); |
| 67 | set(set&& s, const allocator_type& a); |
| 68 | set(initializer_list<value_type> il, const value_compare& comp = value_compare()); |
| 69 | set(initializer_list<value_type> il, const value_compare& comp, |
| 70 | const allocator_type& a); |
Marshall Clow | 631788a | 2013-09-11 00:06:45 +0000 | [diff] [blame] | 71 | template <class InputIterator> |
| 72 | set(InputIterator first, InputIterator last, const allocator_type& a) |
| 73 | : set(first, last, Compare(), a) {} // C++14 |
| 74 | set(initializer_list<value_type> il, const allocator_type& a) |
| 75 | : set(il, Compare(), a) {} // C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 76 | ~set(); |
| 77 | |
| 78 | set& operator=(const set& s); |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 79 | set& operator=(set&& s) |
| 80 | noexcept( |
| 81 | allocator_type::propagate_on_container_move_assignment::value && |
| 82 | is_nothrow_move_assignable<allocator_type>::value && |
| 83 | is_nothrow_move_assignable<key_compare>::value); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 84 | set& operator=(initializer_list<value_type> il); |
| 85 | |
| 86 | // iterators: |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 87 | iterator begin() noexcept; |
| 88 | const_iterator begin() const noexcept; |
| 89 | iterator end() noexcept; |
| 90 | const_iterator end() const noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 91 | |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 92 | reverse_iterator rbegin() noexcept; |
| 93 | const_reverse_iterator rbegin() const noexcept; |
| 94 | reverse_iterator rend() noexcept; |
| 95 | const_reverse_iterator rend() const noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 96 | |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 97 | const_iterator cbegin() const noexcept; |
| 98 | const_iterator cend() const noexcept; |
| 99 | const_reverse_iterator crbegin() const noexcept; |
| 100 | const_reverse_iterator crend() const noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 101 | |
| 102 | // capacity: |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 103 | bool empty() const noexcept; |
| 104 | size_type size() const noexcept; |
| 105 | size_type max_size() const noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 106 | |
| 107 | // modifiers: |
| 108 | template <class... Args> |
| 109 | pair<iterator, bool> emplace(Args&&... args); |
| 110 | template <class... Args> |
| 111 | iterator emplace_hint(const_iterator position, Args&&... args); |
| 112 | pair<iterator,bool> insert(const value_type& v); |
| 113 | pair<iterator,bool> insert(value_type&& v); |
| 114 | iterator insert(const_iterator position, const value_type& v); |
| 115 | iterator insert(const_iterator position, value_type&& v); |
| 116 | template <class InputIterator> |
| 117 | void insert(InputIterator first, InputIterator last); |
| 118 | void insert(initializer_list<value_type> il); |
| 119 | |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 120 | node_type extract(const_iterator position); // C++17 |
| 121 | node_type extract(const key_type& x); // C++17 |
| 122 | insert_return_type insert(node_type&& nh); // C++17 |
| 123 | iterator insert(const_iterator hint, node_type&& nh); // C++17 |
| 124 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 125 | iterator erase(const_iterator position); |
Marshall Clow | 22ea5b8 | 2015-05-10 13:35:00 +0000 | [diff] [blame] | 126 | iterator erase(iterator position); // C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 127 | size_type erase(const key_type& k); |
| 128 | iterator erase(const_iterator first, const_iterator last); |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 129 | void clear() noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 130 | |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 131 | template<class C2> |
| 132 | void merge(set<Key, C2, Allocator>& source); // C++17 |
| 133 | template<class C2> |
| 134 | void merge(set<Key, C2, Allocator>&& source); // C++17 |
| 135 | template<class C2> |
| 136 | void merge(multiset<Key, C2, Allocator>& source); // C++17 |
| 137 | template<class C2> |
| 138 | void merge(multiset<Key, C2, Allocator>&& source); // C++17 |
| 139 | |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 140 | void swap(set& s) |
| 141 | noexcept( |
| 142 | __is_nothrow_swappable<key_compare>::value && |
| 143 | (!allocator_type::propagate_on_container_swap::value || |
| 144 | __is_nothrow_swappable<allocator_type>::value)); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 145 | |
| 146 | // observers: |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 147 | allocator_type get_allocator() const noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 148 | key_compare key_comp() const; |
| 149 | value_compare value_comp() const; |
| 150 | |
| 151 | // set operations: |
| 152 | iterator find(const key_type& k); |
| 153 | const_iterator find(const key_type& k) const; |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 154 | template<typename K> |
| 155 | iterator find(const K& x); |
| 156 | template<typename K> |
| 157 | const_iterator find(const K& x) const; // C++14 |
| 158 | template<typename K> |
| 159 | size_type count(const K& x) const; // C++14 |
| 160 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 161 | size_type count(const key_type& k) const; |
| 162 | iterator lower_bound(const key_type& k); |
| 163 | const_iterator lower_bound(const key_type& k) const; |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 164 | template<typename K> |
| 165 | iterator lower_bound(const K& x); // C++14 |
| 166 | template<typename K> |
| 167 | const_iterator lower_bound(const K& x) const; // C++14 |
| 168 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 169 | iterator upper_bound(const key_type& k); |
| 170 | const_iterator upper_bound(const key_type& k) const; |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 171 | template<typename K> |
| 172 | iterator upper_bound(const K& x); // C++14 |
| 173 | template<typename K> |
| 174 | const_iterator upper_bound(const K& x) const; // C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 175 | pair<iterator,iterator> equal_range(const key_type& k); |
| 176 | pair<const_iterator,const_iterator> equal_range(const key_type& k) const; |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 177 | template<typename K> |
| 178 | pair<iterator,iterator> equal_range(const K& x); // C++14 |
| 179 | template<typename K> |
| 180 | pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 181 | }; |
| 182 | |
| 183 | template <class Key, class Compare, class Allocator> |
| 184 | bool |
| 185 | operator==(const set<Key, Compare, Allocator>& x, |
| 186 | const set<Key, Compare, Allocator>& y); |
| 187 | |
| 188 | template <class Key, class Compare, class Allocator> |
| 189 | bool |
| 190 | operator< (const set<Key, Compare, Allocator>& x, |
| 191 | const set<Key, Compare, Allocator>& y); |
| 192 | |
| 193 | template <class Key, class Compare, class Allocator> |
| 194 | bool |
| 195 | operator!=(const set<Key, Compare, Allocator>& x, |
| 196 | const set<Key, Compare, Allocator>& y); |
| 197 | |
| 198 | template <class Key, class Compare, class Allocator> |
| 199 | bool |
| 200 | operator> (const set<Key, Compare, Allocator>& x, |
| 201 | const set<Key, Compare, Allocator>& y); |
| 202 | |
| 203 | template <class Key, class Compare, class Allocator> |
| 204 | bool |
| 205 | operator>=(const set<Key, Compare, Allocator>& x, |
| 206 | const set<Key, Compare, Allocator>& y); |
| 207 | |
| 208 | template <class Key, class Compare, class Allocator> |
| 209 | bool |
| 210 | operator<=(const set<Key, Compare, Allocator>& x, |
| 211 | const set<Key, Compare, Allocator>& y); |
| 212 | |
| 213 | // specialized algorithms: |
| 214 | template <class Key, class Compare, class Allocator> |
| 215 | void |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 216 | swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y) |
| 217 | noexcept(noexcept(x.swap(y))); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 218 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 219 | template <class Key, class Compare = less<Key>, |
| 220 | class Allocator = allocator<Key>> |
| 221 | class multiset |
| 222 | { |
| 223 | public: |
| 224 | // types: |
| 225 | typedef Key key_type; |
| 226 | typedef key_type value_type; |
| 227 | typedef Compare key_compare; |
| 228 | typedef key_compare value_compare; |
| 229 | typedef Allocator allocator_type; |
| 230 | typedef typename allocator_type::reference reference; |
| 231 | typedef typename allocator_type::const_reference const_reference; |
| 232 | typedef typename allocator_type::size_type size_type; |
| 233 | typedef typename allocator_type::difference_type difference_type; |
| 234 | typedef typename allocator_type::pointer pointer; |
| 235 | typedef typename allocator_type::const_pointer const_pointer; |
| 236 | |
| 237 | typedef implementation-defined iterator; |
| 238 | typedef implementation-defined const_iterator; |
| 239 | typedef std::reverse_iterator<iterator> reverse_iterator; |
| 240 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 241 | typedef unspecified node_type; // C++17 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 242 | |
| 243 | // construct/copy/destroy: |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 244 | multiset() |
| 245 | noexcept( |
| 246 | is_nothrow_default_constructible<allocator_type>::value && |
| 247 | is_nothrow_default_constructible<key_compare>::value && |
| 248 | is_nothrow_copy_constructible<key_compare>::value); |
| 249 | explicit multiset(const value_compare& comp); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 250 | multiset(const value_compare& comp, const allocator_type& a); |
| 251 | template <class InputIterator> |
| 252 | multiset(InputIterator first, InputIterator last, |
| 253 | const value_compare& comp = value_compare()); |
| 254 | template <class InputIterator> |
| 255 | multiset(InputIterator first, InputIterator last, |
| 256 | const value_compare& comp, const allocator_type& a); |
| 257 | multiset(const multiset& s); |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 258 | multiset(multiset&& s) |
| 259 | noexcept( |
| 260 | is_nothrow_move_constructible<allocator_type>::value && |
| 261 | is_nothrow_move_constructible<key_compare>::value); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 262 | explicit multiset(const allocator_type& a); |
| 263 | multiset(const multiset& s, const allocator_type& a); |
| 264 | multiset(multiset&& s, const allocator_type& a); |
| 265 | multiset(initializer_list<value_type> il, const value_compare& comp = value_compare()); |
| 266 | multiset(initializer_list<value_type> il, const value_compare& comp, |
| 267 | const allocator_type& a); |
Marshall Clow | 631788a | 2013-09-11 00:06:45 +0000 | [diff] [blame] | 268 | template <class InputIterator> |
| 269 | multiset(InputIterator first, InputIterator last, const allocator_type& a) |
| 270 | : set(first, last, Compare(), a) {} // C++14 |
| 271 | multiset(initializer_list<value_type> il, const allocator_type& a) |
| 272 | : set(il, Compare(), a) {} // C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 273 | ~multiset(); |
| 274 | |
| 275 | multiset& operator=(const multiset& s); |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 276 | multiset& operator=(multiset&& s) |
| 277 | noexcept( |
| 278 | allocator_type::propagate_on_container_move_assignment::value && |
| 279 | is_nothrow_move_assignable<allocator_type>::value && |
| 280 | is_nothrow_move_assignable<key_compare>::value); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 281 | multiset& operator=(initializer_list<value_type> il); |
| 282 | |
| 283 | // iterators: |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 284 | iterator begin() noexcept; |
| 285 | const_iterator begin() const noexcept; |
| 286 | iterator end() noexcept; |
| 287 | const_iterator end() const noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 288 | |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 289 | reverse_iterator rbegin() noexcept; |
| 290 | const_reverse_iterator rbegin() const noexcept; |
| 291 | reverse_iterator rend() noexcept; |
| 292 | const_reverse_iterator rend() const noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 293 | |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 294 | const_iterator cbegin() const noexcept; |
| 295 | const_iterator cend() const noexcept; |
| 296 | const_reverse_iterator crbegin() const noexcept; |
| 297 | const_reverse_iterator crend() const noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 298 | |
| 299 | // capacity: |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 300 | bool empty() const noexcept; |
| 301 | size_type size() const noexcept; |
| 302 | size_type max_size() const noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 303 | |
| 304 | // modifiers: |
| 305 | template <class... Args> |
| 306 | iterator emplace(Args&&... args); |
| 307 | template <class... Args> |
| 308 | iterator emplace_hint(const_iterator position, Args&&... args); |
| 309 | iterator insert(const value_type& v); |
| 310 | iterator insert(value_type&& v); |
| 311 | iterator insert(const_iterator position, const value_type& v); |
| 312 | iterator insert(const_iterator position, value_type&& v); |
| 313 | template <class InputIterator> |
| 314 | void insert(InputIterator first, InputIterator last); |
| 315 | void insert(initializer_list<value_type> il); |
| 316 | |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 317 | node_type extract(const_iterator position); // C++17 |
| 318 | node_type extract(const key_type& x); // C++17 |
| 319 | iterator insert(node_type&& nh); // C++17 |
| 320 | iterator insert(const_iterator hint, node_type&& nh); // C++17 |
| 321 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 322 | iterator erase(const_iterator position); |
Marshall Clow | 22ea5b8 | 2015-05-10 13:35:00 +0000 | [diff] [blame] | 323 | iterator erase(iterator position); // C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 324 | size_type erase(const key_type& k); |
| 325 | iterator erase(const_iterator first, const_iterator last); |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 326 | void clear() noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 327 | |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 328 | template<class C2> |
| 329 | void merge(multiset<Key, C2, Allocator>& source); // C++17 |
| 330 | template<class C2> |
| 331 | void merge(multiset<Key, C2, Allocator>&& source); // C++17 |
| 332 | template<class C2> |
| 333 | void merge(set<Key, C2, Allocator>& source); // C++17 |
| 334 | template<class C2> |
| 335 | void merge(set<Key, C2, Allocator>&& source); // C++17 |
| 336 | |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 337 | void swap(multiset& s) |
| 338 | noexcept( |
| 339 | __is_nothrow_swappable<key_compare>::value && |
| 340 | (!allocator_type::propagate_on_container_swap::value || |
| 341 | __is_nothrow_swappable<allocator_type>::value)); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 342 | |
| 343 | // observers: |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 344 | allocator_type get_allocator() const noexcept; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 345 | key_compare key_comp() const; |
| 346 | value_compare value_comp() const; |
| 347 | |
| 348 | // set operations: |
| 349 | iterator find(const key_type& k); |
| 350 | const_iterator find(const key_type& k) const; |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 351 | template<typename K> |
| 352 | iterator find(const K& x); |
| 353 | template<typename K> |
| 354 | const_iterator find(const K& x) const; // C++14 |
| 355 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 356 | size_type count(const key_type& k) const; |
| 357 | iterator lower_bound(const key_type& k); |
| 358 | const_iterator lower_bound(const key_type& k) const; |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 359 | template<typename K> |
| 360 | iterator lower_bound(const K& x); // C++14 |
| 361 | template<typename K> |
| 362 | const_iterator lower_bound(const K& x) const; // C++14 |
| 363 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 364 | iterator upper_bound(const key_type& k); |
| 365 | const_iterator upper_bound(const key_type& k) const; |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 366 | template<typename K> |
| 367 | iterator upper_bound(const K& x); // C++14 |
| 368 | template<typename K> |
| 369 | const_iterator upper_bound(const K& x) const; // C++14 |
| 370 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 371 | pair<iterator,iterator> equal_range(const key_type& k); |
| 372 | pair<const_iterator,const_iterator> equal_range(const key_type& k) const; |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 373 | template<typename K> |
| 374 | pair<iterator,iterator> equal_range(const K& x); // C++14 |
| 375 | template<typename K> |
| 376 | pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 377 | }; |
| 378 | |
| 379 | template <class Key, class Compare, class Allocator> |
| 380 | bool |
| 381 | operator==(const multiset<Key, Compare, Allocator>& x, |
| 382 | const multiset<Key, Compare, Allocator>& y); |
| 383 | |
| 384 | template <class Key, class Compare, class Allocator> |
| 385 | bool |
| 386 | operator< (const multiset<Key, Compare, Allocator>& x, |
| 387 | const multiset<Key, Compare, Allocator>& y); |
| 388 | |
| 389 | template <class Key, class Compare, class Allocator> |
| 390 | bool |
| 391 | operator!=(const multiset<Key, Compare, Allocator>& x, |
| 392 | const multiset<Key, Compare, Allocator>& y); |
| 393 | |
| 394 | template <class Key, class Compare, class Allocator> |
| 395 | bool |
| 396 | operator> (const multiset<Key, Compare, Allocator>& x, |
| 397 | const multiset<Key, Compare, Allocator>& y); |
| 398 | |
| 399 | template <class Key, class Compare, class Allocator> |
| 400 | bool |
| 401 | operator>=(const multiset<Key, Compare, Allocator>& x, |
| 402 | const multiset<Key, Compare, Allocator>& y); |
| 403 | |
| 404 | template <class Key, class Compare, class Allocator> |
| 405 | bool |
| 406 | operator<=(const multiset<Key, Compare, Allocator>& x, |
| 407 | const multiset<Key, Compare, Allocator>& y); |
| 408 | |
| 409 | // specialized algorithms: |
| 410 | template <class Key, class Compare, class Allocator> |
| 411 | void |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 412 | swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y) |
| 413 | noexcept(noexcept(x.swap(y))); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 414 | |
| 415 | } // std |
| 416 | |
| 417 | */ |
| 418 | |
| 419 | #include <__config> |
| 420 | #include <__tree> |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 421 | #include <__node_handle> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 422 | #include <functional> |
Marshall Clow | 0a1e750 | 2018-09-12 19:41:40 +0000 | [diff] [blame] | 423 | #include <version> |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 424 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 425 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 426 | #pragma GCC system_header |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 427 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 428 | |
| 429 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 430 | |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 431 | template <class _Key, class _Compare, class _Allocator> |
| 432 | class multiset; |
| 433 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 434 | template <class _Key, class _Compare = less<_Key>, |
| 435 | class _Allocator = allocator<_Key> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 436 | class _LIBCPP_TEMPLATE_VIS set |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 437 | { |
| 438 | public: |
| 439 | // types: |
| 440 | typedef _Key key_type; |
| 441 | typedef key_type value_type; |
| 442 | typedef _Compare key_compare; |
| 443 | typedef key_compare value_compare; |
| 444 | typedef _Allocator allocator_type; |
| 445 | typedef value_type& reference; |
| 446 | typedef const value_type& const_reference; |
| 447 | |
Louis Dionne | 878a3a8 | 2018-12-06 21:46:17 +0000 | [diff] [blame] | 448 | static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); |
Marshall Clow | 5128cf3 | 2015-11-26 01:24:04 +0000 | [diff] [blame] | 449 | static_assert((is_same<typename allocator_type::value_type, value_type>::value), |
| 450 | "Allocator::value_type must be same type as value_type"); |
| 451 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 452 | private: |
| 453 | typedef __tree<value_type, value_compare, allocator_type> __base; |
| 454 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 455 | typedef typename __base::__node_holder __node_holder; |
| 456 | |
| 457 | __base __tree_; |
| 458 | |
| 459 | public: |
| 460 | typedef typename __base::pointer pointer; |
| 461 | typedef typename __base::const_pointer const_pointer; |
| 462 | typedef typename __base::size_type size_type; |
| 463 | typedef typename __base::difference_type difference_type; |
| 464 | typedef typename __base::const_iterator iterator; |
| 465 | typedef typename __base::const_iterator const_iterator; |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 466 | typedef _VSTD::reverse_iterator<iterator> reverse_iterator; |
| 467 | typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 468 | |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 469 | #if _LIBCPP_STD_VER > 14 |
| 470 | typedef __set_node_handle<typename __base::__node, allocator_type> node_type; |
| 471 | typedef __insert_return_type<iterator, node_type> insert_return_type; |
| 472 | #endif |
| 473 | |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 474 | template <class _Key2, class _Compare2, class _Alloc2> |
| 475 | friend class _LIBCPP_TEMPLATE_VIS set; |
| 476 | template <class _Key2, class _Compare2, class _Alloc2> |
| 477 | friend class _LIBCPP_TEMPLATE_VIS multiset; |
| 478 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 479 | _LIBCPP_INLINE_VISIBILITY |
Marshall Clow | 7086a5a | 2014-03-10 04:50:10 +0000 | [diff] [blame] | 480 | set() |
| 481 | _NOEXCEPT_( |
| 482 | is_nothrow_default_constructible<allocator_type>::value && |
| 483 | is_nothrow_default_constructible<key_compare>::value && |
| 484 | is_nothrow_copy_constructible<key_compare>::value) |
| 485 | : __tree_(value_compare()) {} |
| 486 | |
| 487 | _LIBCPP_INLINE_VISIBILITY |
| 488 | explicit set(const value_compare& __comp) |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 489 | _NOEXCEPT_( |
| 490 | is_nothrow_default_constructible<allocator_type>::value && |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 491 | is_nothrow_copy_constructible<key_compare>::value) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 492 | : __tree_(__comp) {} |
Marshall Clow | 7086a5a | 2014-03-10 04:50:10 +0000 | [diff] [blame] | 493 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 494 | _LIBCPP_INLINE_VISIBILITY |
Marshall Clow | 7ed23a7 | 2014-03-05 19:06:20 +0000 | [diff] [blame] | 495 | explicit set(const value_compare& __comp, const allocator_type& __a) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 496 | : __tree_(__comp, __a) {} |
| 497 | template <class _InputIterator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 498 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 499 | set(_InputIterator __f, _InputIterator __l, |
| 500 | const value_compare& __comp = value_compare()) |
| 501 | : __tree_(__comp) |
| 502 | { |
| 503 | insert(__f, __l); |
| 504 | } |
| 505 | |
| 506 | template <class _InputIterator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 507 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 508 | set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, |
| 509 | const allocator_type& __a) |
| 510 | : __tree_(__comp, __a) |
| 511 | { |
| 512 | insert(__f, __l); |
| 513 | } |
| 514 | |
Marshall Clow | 631788a | 2013-09-11 00:06:45 +0000 | [diff] [blame] | 515 | #if _LIBCPP_STD_VER > 11 |
| 516 | template <class _InputIterator> |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 517 | _LIBCPP_INLINE_VISIBILITY |
Marshall Clow | 631788a | 2013-09-11 00:06:45 +0000 | [diff] [blame] | 518 | set(_InputIterator __f, _InputIterator __l, const allocator_type& __a) |
| 519 | : set(__f, __l, key_compare(), __a) {} |
| 520 | #endif |
| 521 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 522 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 523 | set(const set& __s) |
| 524 | : __tree_(__s.__tree_) |
| 525 | { |
| 526 | insert(__s.begin(), __s.end()); |
| 527 | } |
| 528 | |
Howard Hinnant | d3a657f | 2011-07-01 19:24:36 +0000 | [diff] [blame] | 529 | _LIBCPP_INLINE_VISIBILITY |
| 530 | set& operator=(const set& __s) |
| 531 | { |
| 532 | __tree_ = __s.__tree_; |
| 533 | return *this; |
| 534 | } |
| 535 | |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 536 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 537 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 538 | set(set&& __s) |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 539 | _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 540 | : __tree_(_VSTD::move(__s.__tree_)) {} |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 541 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 542 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 543 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 544 | explicit set(const allocator_type& __a) |
| 545 | : __tree_(__a) {} |
| 546 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 547 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 548 | set(const set& __s, const allocator_type& __a) |
| 549 | : __tree_(__s.__tree_.value_comp(), __a) |
| 550 | { |
| 551 | insert(__s.begin(), __s.end()); |
| 552 | } |
| 553 | |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 554 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 555 | set(set&& __s, const allocator_type& __a); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 556 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 557 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 558 | set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) |
| 559 | : __tree_(__comp) |
| 560 | { |
| 561 | insert(__il.begin(), __il.end()); |
| 562 | } |
| 563 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 564 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 565 | set(initializer_list<value_type> __il, const value_compare& __comp, |
| 566 | const allocator_type& __a) |
| 567 | : __tree_(__comp, __a) |
| 568 | { |
| 569 | insert(__il.begin(), __il.end()); |
| 570 | } |
| 571 | |
Marshall Clow | 631788a | 2013-09-11 00:06:45 +0000 | [diff] [blame] | 572 | #if _LIBCPP_STD_VER > 11 |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 573 | _LIBCPP_INLINE_VISIBILITY |
Marshall Clow | 631788a | 2013-09-11 00:06:45 +0000 | [diff] [blame] | 574 | set(initializer_list<value_type> __il, const allocator_type& __a) |
| 575 | : set(__il, key_compare(), __a) {} |
| 576 | #endif |
| 577 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 578 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 579 | set& operator=(initializer_list<value_type> __il) |
| 580 | { |
| 581 | __tree_.__assign_unique(__il.begin(), __il.end()); |
| 582 | return *this; |
| 583 | } |
| 584 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 585 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 586 | set& operator=(set&& __s) |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 587 | _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 588 | { |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 589 | __tree_ = _VSTD::move(__s.__tree_); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 590 | return *this; |
| 591 | } |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 592 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 593 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 594 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 595 | iterator begin() _NOEXCEPT {return __tree_.begin();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 596 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 597 | const_iterator begin() const _NOEXCEPT {return __tree_.begin();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 598 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 599 | iterator end() _NOEXCEPT {return __tree_.end();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 600 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 601 | const_iterator end() const _NOEXCEPT {return __tree_.end();} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 602 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 603 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 604 | reverse_iterator rbegin() _NOEXCEPT |
| 605 | {return reverse_iterator(end());} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 606 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 607 | const_reverse_iterator rbegin() const _NOEXCEPT |
| 608 | {return const_reverse_iterator(end());} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 609 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 610 | reverse_iterator rend() _NOEXCEPT |
| 611 | {return reverse_iterator(begin());} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 612 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 613 | const_reverse_iterator rend() const _NOEXCEPT |
| 614 | {return const_reverse_iterator(begin());} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 615 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 616 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 617 | const_iterator cbegin() const _NOEXCEPT {return begin();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 618 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 619 | const_iterator cend() const _NOEXCEPT {return end();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 620 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 621 | const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 622 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 623 | const_reverse_iterator crend() const _NOEXCEPT {return rend();} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 624 | |
Marshall Clow | 425f575 | 2017-11-15 05:51:26 +0000 | [diff] [blame] | 625 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 626 | bool empty() const _NOEXCEPT {return __tree_.size() == 0;} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 627 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 628 | size_type size() const _NOEXCEPT {return __tree_.size();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 629 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 630 | size_type max_size() const _NOEXCEPT {return __tree_.max_size();} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 631 | |
| 632 | // modifiers: |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 633 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 634 | template <class... _Args> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 635 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 636 | pair<iterator, bool> emplace(_Args&&... __args) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 637 | {return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 638 | template <class... _Args> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 639 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 640 | iterator emplace_hint(const_iterator __p, _Args&&... __args) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 641 | {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);} |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 642 | #endif // _LIBCPP_CXX03_LANG |
| 643 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 644 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 645 | pair<iterator,bool> insert(const value_type& __v) |
| 646 | {return __tree_.__insert_unique(__v);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 647 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 648 | iterator insert(const_iterator __p, const value_type& __v) |
| 649 | {return __tree_.__insert_unique(__p, __v);} |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 650 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 651 | template <class _InputIterator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 652 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 653 | void insert(_InputIterator __f, _InputIterator __l) |
| 654 | { |
| 655 | for (const_iterator __e = cend(); __f != __l; ++__f) |
| 656 | __tree_.__insert_unique(__e, *__f); |
| 657 | } |
| 658 | |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 659 | #ifndef _LIBCPP_CXX03_LANG |
| 660 | _LIBCPP_INLINE_VISIBILITY |
| 661 | pair<iterator,bool> insert(value_type&& __v) |
| 662 | {return __tree_.__insert_unique(_VSTD::move(__v));} |
| 663 | |
| 664 | _LIBCPP_INLINE_VISIBILITY |
| 665 | iterator insert(const_iterator __p, value_type&& __v) |
| 666 | {return __tree_.__insert_unique(__p, _VSTD::move(__v));} |
| 667 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 668 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 669 | void insert(initializer_list<value_type> __il) |
| 670 | {insert(__il.begin(), __il.end());} |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 671 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 672 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 673 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 674 | iterator erase(const_iterator __p) {return __tree_.erase(__p);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 675 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 676 | size_type erase(const key_type& __k) |
| 677 | {return __tree_.__erase_unique(__k);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 678 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 679 | iterator erase(const_iterator __f, const_iterator __l) |
| 680 | {return __tree_.erase(__f, __l);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 681 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 682 | void clear() _NOEXCEPT {__tree_.clear();} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 683 | |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 684 | #if _LIBCPP_STD_VER > 14 |
| 685 | _LIBCPP_INLINE_VISIBILITY |
| 686 | insert_return_type insert(node_type&& __nh) |
| 687 | { |
| 688 | _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 689 | "node_type with incompatible allocator passed to set::insert()"); |
| 690 | return __tree_.template __node_handle_insert_unique< |
| 691 | node_type, insert_return_type>(_VSTD::move(__nh)); |
| 692 | } |
| 693 | _LIBCPP_INLINE_VISIBILITY |
| 694 | iterator insert(const_iterator __hint, node_type&& __nh) |
| 695 | { |
| 696 | _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 697 | "node_type with incompatible allocator passed to set::insert()"); |
| 698 | return __tree_.template __node_handle_insert_unique<node_type>( |
| 699 | __hint, _VSTD::move(__nh)); |
| 700 | } |
| 701 | _LIBCPP_INLINE_VISIBILITY |
| 702 | node_type extract(key_type const& __key) |
| 703 | { |
| 704 | return __tree_.template __node_handle_extract<node_type>(__key); |
| 705 | } |
| 706 | _LIBCPP_INLINE_VISIBILITY |
| 707 | node_type extract(const_iterator __it) |
| 708 | { |
| 709 | return __tree_.template __node_handle_extract<node_type>(__it); |
| 710 | } |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 711 | template <class _Compare2> |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 712 | _LIBCPP_INLINE_VISIBILITY |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 713 | void merge(set<key_type, _Compare2, allocator_type>& __source) |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 714 | { |
| 715 | _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), |
| 716 | "merging container with incompatible allocator"); |
| 717 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 718 | } |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 719 | template <class _Compare2> |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 720 | _LIBCPP_INLINE_VISIBILITY |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 721 | void merge(set<key_type, _Compare2, allocator_type>&& __source) |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 722 | { |
| 723 | _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), |
| 724 | "merging container with incompatible allocator"); |
| 725 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 726 | } |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 727 | template <class _Compare2> |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 728 | _LIBCPP_INLINE_VISIBILITY |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 729 | void merge(multiset<key_type, _Compare2, allocator_type>& __source) |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 730 | { |
| 731 | _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), |
| 732 | "merging container with incompatible allocator"); |
| 733 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 734 | } |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 735 | template <class _Compare2> |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 736 | _LIBCPP_INLINE_VISIBILITY |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 737 | void merge(multiset<key_type, _Compare2, allocator_type>&& __source) |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 738 | { |
| 739 | _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), |
| 740 | "merging container with incompatible allocator"); |
| 741 | __tree_.__node_handle_merge_unique(__source.__tree_); |
| 742 | } |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 743 | #endif |
| 744 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 745 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 746 | void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) |
| 747 | {__tree_.swap(__s.__tree_);} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 748 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 749 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 750 | allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 751 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 752 | key_compare key_comp() const {return __tree_.value_comp();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 753 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 754 | value_compare value_comp() const {return __tree_.value_comp();} |
| 755 | |
| 756 | // set operations: |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 757 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 758 | iterator find(const key_type& __k) {return __tree_.find(__k);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 759 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 760 | const_iterator find(const key_type& __k) const {return __tree_.find(__k);} |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 761 | #if _LIBCPP_STD_VER > 11 |
| 762 | template <typename _K2> |
| 763 | _LIBCPP_INLINE_VISIBILITY |
| 764 | typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type |
| 765 | find(const _K2& __k) {return __tree_.find(__k);} |
| 766 | template <typename _K2> |
| 767 | _LIBCPP_INLINE_VISIBILITY |
| 768 | typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type |
| 769 | find(const _K2& __k) const {return __tree_.find(__k);} |
| 770 | #endif |
| 771 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 772 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 773 | size_type count(const key_type& __k) const |
| 774 | {return __tree_.__count_unique(__k);} |
Marshall Clow | e6a5f52 | 2014-08-24 23:54:16 +0000 | [diff] [blame] | 775 | #if _LIBCPP_STD_VER > 11 |
| 776 | template <typename _K2> |
| 777 | _LIBCPP_INLINE_VISIBILITY |
| 778 | typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type |
Eric Fiselier | a85c9e9 | 2018-02-10 02:53:47 +0000 | [diff] [blame] | 779 | count(const _K2& __k) const {return __tree_.__count_multi(__k);} |
Marshall Clow | e6a5f52 | 2014-08-24 23:54:16 +0000 | [diff] [blame] | 780 | #endif |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 781 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 782 | iterator lower_bound(const key_type& __k) |
| 783 | {return __tree_.lower_bound(__k);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 784 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 785 | const_iterator lower_bound(const key_type& __k) const |
| 786 | {return __tree_.lower_bound(__k);} |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 787 | #if _LIBCPP_STD_VER > 11 |
| 788 | template <typename _K2> |
| 789 | _LIBCPP_INLINE_VISIBILITY |
| 790 | typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type |
| 791 | lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} |
| 792 | |
| 793 | template <typename _K2> |
| 794 | _LIBCPP_INLINE_VISIBILITY |
| 795 | typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type |
| 796 | lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} |
| 797 | #endif |
| 798 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 799 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 800 | iterator upper_bound(const key_type& __k) |
| 801 | {return __tree_.upper_bound(__k);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 802 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 803 | const_iterator upper_bound(const key_type& __k) const |
| 804 | {return __tree_.upper_bound(__k);} |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 805 | #if _LIBCPP_STD_VER > 11 |
| 806 | template <typename _K2> |
| 807 | _LIBCPP_INLINE_VISIBILITY |
| 808 | typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type |
| 809 | upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} |
| 810 | template <typename _K2> |
| 811 | _LIBCPP_INLINE_VISIBILITY |
| 812 | typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type |
| 813 | upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} |
| 814 | #endif |
| 815 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 816 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 817 | pair<iterator,iterator> equal_range(const key_type& __k) |
| 818 | {return __tree_.__equal_range_unique(__k);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 819 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 820 | pair<const_iterator,const_iterator> equal_range(const key_type& __k) const |
| 821 | {return __tree_.__equal_range_unique(__k);} |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 822 | #if _LIBCPP_STD_VER > 11 |
| 823 | template <typename _K2> |
| 824 | _LIBCPP_INLINE_VISIBILITY |
| 825 | typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type |
Eric Fiselier | a85c9e9 | 2018-02-10 02:53:47 +0000 | [diff] [blame] | 826 | equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 827 | template <typename _K2> |
| 828 | _LIBCPP_INLINE_VISIBILITY |
| 829 | typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type |
Eric Fiselier | a85c9e9 | 2018-02-10 02:53:47 +0000 | [diff] [blame] | 830 | equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 831 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 832 | }; |
| 833 | |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 834 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 835 | |
| 836 | template <class _Key, class _Compare, class _Allocator> |
| 837 | set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 838 | : __tree_(_VSTD::move(__s.__tree_), __a) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 839 | { |
| 840 | if (__a != __s.get_allocator()) |
| 841 | { |
| 842 | const_iterator __e = cend(); |
| 843 | while (!__s.empty()) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 844 | insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_)); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 845 | } |
| 846 | } |
| 847 | |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 848 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 849 | |
| 850 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 851 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 852 | bool |
| 853 | operator==(const set<_Key, _Compare, _Allocator>& __x, |
| 854 | const set<_Key, _Compare, _Allocator>& __y) |
| 855 | { |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 856 | return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 857 | } |
| 858 | |
| 859 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 860 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 861 | bool |
| 862 | operator< (const set<_Key, _Compare, _Allocator>& __x, |
| 863 | const set<_Key, _Compare, _Allocator>& __y) |
| 864 | { |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 865 | return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 866 | } |
| 867 | |
| 868 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 869 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 870 | bool |
| 871 | operator!=(const set<_Key, _Compare, _Allocator>& __x, |
| 872 | const set<_Key, _Compare, _Allocator>& __y) |
| 873 | { |
| 874 | return !(__x == __y); |
| 875 | } |
| 876 | |
| 877 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 878 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 879 | bool |
| 880 | operator> (const set<_Key, _Compare, _Allocator>& __x, |
| 881 | const set<_Key, _Compare, _Allocator>& __y) |
| 882 | { |
| 883 | return __y < __x; |
| 884 | } |
| 885 | |
| 886 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 887 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 888 | bool |
| 889 | operator>=(const set<_Key, _Compare, _Allocator>& __x, |
| 890 | const set<_Key, _Compare, _Allocator>& __y) |
| 891 | { |
| 892 | return !(__x < __y); |
| 893 | } |
| 894 | |
| 895 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 896 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 897 | bool |
| 898 | operator<=(const set<_Key, _Compare, _Allocator>& __x, |
| 899 | const set<_Key, _Compare, _Allocator>& __y) |
| 900 | { |
| 901 | return !(__y < __x); |
| 902 | } |
| 903 | |
| 904 | // specialized algorithms: |
| 905 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 906 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 907 | void |
| 908 | swap(set<_Key, _Compare, _Allocator>& __x, |
| 909 | set<_Key, _Compare, _Allocator>& __y) |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 910 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 911 | { |
| 912 | __x.swap(__y); |
| 913 | } |
| 914 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 915 | template <class _Key, class _Compare = less<_Key>, |
| 916 | class _Allocator = allocator<_Key> > |
Eric Fiselier | b5eb1bf | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 917 | class _LIBCPP_TEMPLATE_VIS multiset |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 918 | { |
| 919 | public: |
| 920 | // types: |
| 921 | typedef _Key key_type; |
| 922 | typedef key_type value_type; |
| 923 | typedef _Compare key_compare; |
| 924 | typedef key_compare value_compare; |
| 925 | typedef _Allocator allocator_type; |
| 926 | typedef value_type& reference; |
| 927 | typedef const value_type& const_reference; |
| 928 | |
Louis Dionne | 878a3a8 | 2018-12-06 21:46:17 +0000 | [diff] [blame] | 929 | static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); |
Marshall Clow | 5128cf3 | 2015-11-26 01:24:04 +0000 | [diff] [blame] | 930 | static_assert((is_same<typename allocator_type::value_type, value_type>::value), |
| 931 | "Allocator::value_type must be same type as value_type"); |
| 932 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 933 | private: |
| 934 | typedef __tree<value_type, value_compare, allocator_type> __base; |
| 935 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 936 | typedef typename __base::__node_holder __node_holder; |
| 937 | |
| 938 | __base __tree_; |
| 939 | |
| 940 | public: |
| 941 | typedef typename __base::pointer pointer; |
| 942 | typedef typename __base::const_pointer const_pointer; |
| 943 | typedef typename __base::size_type size_type; |
| 944 | typedef typename __base::difference_type difference_type; |
| 945 | typedef typename __base::const_iterator iterator; |
| 946 | typedef typename __base::const_iterator const_iterator; |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 947 | typedef _VSTD::reverse_iterator<iterator> reverse_iterator; |
| 948 | typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 949 | |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 950 | #if _LIBCPP_STD_VER > 14 |
| 951 | typedef __set_node_handle<typename __base::__node, allocator_type> node_type; |
| 952 | #endif |
| 953 | |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 954 | template <class _Key2, class _Compare2, class _Alloc2> |
| 955 | friend class _LIBCPP_TEMPLATE_VIS set; |
| 956 | template <class _Key2, class _Compare2, class _Alloc2> |
| 957 | friend class _LIBCPP_TEMPLATE_VIS multiset; |
| 958 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 959 | // construct/copy/destroy: |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 960 | _LIBCPP_INLINE_VISIBILITY |
Marshall Clow | 7086a5a | 2014-03-10 04:50:10 +0000 | [diff] [blame] | 961 | multiset() |
| 962 | _NOEXCEPT_( |
| 963 | is_nothrow_default_constructible<allocator_type>::value && |
| 964 | is_nothrow_default_constructible<key_compare>::value && |
| 965 | is_nothrow_copy_constructible<key_compare>::value) |
| 966 | : __tree_(value_compare()) {} |
| 967 | |
| 968 | _LIBCPP_INLINE_VISIBILITY |
| 969 | explicit multiset(const value_compare& __comp) |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 970 | _NOEXCEPT_( |
| 971 | is_nothrow_default_constructible<allocator_type>::value && |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 972 | is_nothrow_copy_constructible<key_compare>::value) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 973 | : __tree_(__comp) {} |
Marshall Clow | 7086a5a | 2014-03-10 04:50:10 +0000 | [diff] [blame] | 974 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 975 | _LIBCPP_INLINE_VISIBILITY |
Marshall Clow | 7ed23a7 | 2014-03-05 19:06:20 +0000 | [diff] [blame] | 976 | explicit multiset(const value_compare& __comp, const allocator_type& __a) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 977 | : __tree_(__comp, __a) {} |
| 978 | template <class _InputIterator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 979 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 980 | multiset(_InputIterator __f, _InputIterator __l, |
| 981 | const value_compare& __comp = value_compare()) |
| 982 | : __tree_(__comp) |
| 983 | { |
| 984 | insert(__f, __l); |
| 985 | } |
| 986 | |
Marshall Clow | 631788a | 2013-09-11 00:06:45 +0000 | [diff] [blame] | 987 | #if _LIBCPP_STD_VER > 11 |
| 988 | template <class _InputIterator> |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 989 | _LIBCPP_INLINE_VISIBILITY |
Marshall Clow | 631788a | 2013-09-11 00:06:45 +0000 | [diff] [blame] | 990 | multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a) |
| 991 | : multiset(__f, __l, key_compare(), __a) {} |
| 992 | #endif |
| 993 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 994 | template <class _InputIterator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 995 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 996 | multiset(_InputIterator __f, _InputIterator __l, |
| 997 | const value_compare& __comp, const allocator_type& __a) |
| 998 | : __tree_(__comp, __a) |
| 999 | { |
| 1000 | insert(__f, __l); |
| 1001 | } |
| 1002 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1003 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1004 | multiset(const multiset& __s) |
| 1005 | : __tree_(__s.__tree_.value_comp(), |
| 1006 | __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc())) |
| 1007 | { |
| 1008 | insert(__s.begin(), __s.end()); |
| 1009 | } |
| 1010 | |
Howard Hinnant | d3a657f | 2011-07-01 19:24:36 +0000 | [diff] [blame] | 1011 | _LIBCPP_INLINE_VISIBILITY |
| 1012 | multiset& operator=(const multiset& __s) |
| 1013 | { |
| 1014 | __tree_ = __s.__tree_; |
| 1015 | return *this; |
| 1016 | } |
| 1017 | |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1018 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1019 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1020 | multiset(multiset&& __s) |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1021 | _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 1022 | : __tree_(_VSTD::move(__s.__tree_)) {} |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1023 | |
| 1024 | multiset(multiset&& __s, const allocator_type& __a); |
| 1025 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1026 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1027 | explicit multiset(const allocator_type& __a) |
| 1028 | : __tree_(__a) {} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1029 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1030 | multiset(const multiset& __s, const allocator_type& __a) |
| 1031 | : __tree_(__s.__tree_.value_comp(), __a) |
| 1032 | { |
| 1033 | insert(__s.begin(), __s.end()); |
| 1034 | } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1035 | |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1036 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1037 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1038 | multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) |
| 1039 | : __tree_(__comp) |
| 1040 | { |
| 1041 | insert(__il.begin(), __il.end()); |
| 1042 | } |
| 1043 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1044 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1045 | multiset(initializer_list<value_type> __il, const value_compare& __comp, |
| 1046 | const allocator_type& __a) |
| 1047 | : __tree_(__comp, __a) |
| 1048 | { |
| 1049 | insert(__il.begin(), __il.end()); |
| 1050 | } |
| 1051 | |
Marshall Clow | 631788a | 2013-09-11 00:06:45 +0000 | [diff] [blame] | 1052 | #if _LIBCPP_STD_VER > 11 |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 1053 | _LIBCPP_INLINE_VISIBILITY |
Marshall Clow | 631788a | 2013-09-11 00:06:45 +0000 | [diff] [blame] | 1054 | multiset(initializer_list<value_type> __il, const allocator_type& __a) |
| 1055 | : multiset(__il, key_compare(), __a) {} |
| 1056 | #endif |
| 1057 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1058 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1059 | multiset& operator=(initializer_list<value_type> __il) |
| 1060 | { |
| 1061 | __tree_.__assign_multi(__il.begin(), __il.end()); |
| 1062 | return *this; |
| 1063 | } |
| 1064 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1065 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1066 | multiset& operator=(multiset&& __s) |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1067 | _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1068 | { |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 1069 | __tree_ = _VSTD::move(__s.__tree_); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1070 | return *this; |
| 1071 | } |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1072 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1073 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1074 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1075 | iterator begin() _NOEXCEPT {return __tree_.begin();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1076 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1077 | const_iterator begin() const _NOEXCEPT {return __tree_.begin();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1078 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1079 | iterator end() _NOEXCEPT {return __tree_.end();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1080 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1081 | const_iterator end() const _NOEXCEPT {return __tree_.end();} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1082 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1083 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1084 | reverse_iterator rbegin() _NOEXCEPT |
| 1085 | {return reverse_iterator(end());} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1086 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1087 | const_reverse_iterator rbegin() const _NOEXCEPT |
| 1088 | {return const_reverse_iterator(end());} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1089 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1090 | reverse_iterator rend() _NOEXCEPT |
| 1091 | {return reverse_iterator(begin());} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1092 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1093 | const_reverse_iterator rend() const _NOEXCEPT |
| 1094 | {return const_reverse_iterator(begin());} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1095 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1096 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1097 | const_iterator cbegin() const _NOEXCEPT {return begin();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1098 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1099 | const_iterator cend() const _NOEXCEPT {return end();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1100 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1101 | const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1102 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1103 | const_reverse_iterator crend() const _NOEXCEPT {return rend();} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1104 | |
Marshall Clow | 425f575 | 2017-11-15 05:51:26 +0000 | [diff] [blame] | 1105 | _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1106 | bool empty() const _NOEXCEPT {return __tree_.size() == 0;} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1107 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1108 | size_type size() const _NOEXCEPT {return __tree_.size();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1109 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1110 | size_type max_size() const _NOEXCEPT {return __tree_.max_size();} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1111 | |
| 1112 | // modifiers: |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1113 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1114 | template <class... _Args> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1115 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1116 | iterator emplace(_Args&&... __args) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 1117 | {return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1118 | template <class... _Args> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1119 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1120 | iterator emplace_hint(const_iterator __p, _Args&&... __args) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 1121 | {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1122 | #endif // _LIBCPP_CXX03_LANG |
| 1123 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1124 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1125 | iterator insert(const value_type& __v) |
| 1126 | {return __tree_.__insert_multi(__v);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1127 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1128 | iterator insert(const_iterator __p, const value_type& __v) |
| 1129 | {return __tree_.__insert_multi(__p, __v);} |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1130 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1131 | template <class _InputIterator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1132 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1133 | void insert(_InputIterator __f, _InputIterator __l) |
| 1134 | { |
| 1135 | for (const_iterator __e = cend(); __f != __l; ++__f) |
| 1136 | __tree_.__insert_multi(__e, *__f); |
| 1137 | } |
| 1138 | |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1139 | #ifndef _LIBCPP_CXX03_LANG |
| 1140 | _LIBCPP_INLINE_VISIBILITY |
| 1141 | iterator insert(value_type&& __v) |
| 1142 | {return __tree_.__insert_multi(_VSTD::move(__v));} |
| 1143 | |
| 1144 | _LIBCPP_INLINE_VISIBILITY |
| 1145 | iterator insert(const_iterator __p, value_type&& __v) |
| 1146 | {return __tree_.__insert_multi(__p, _VSTD::move(__v));} |
| 1147 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1148 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1149 | void insert(initializer_list<value_type> __il) |
| 1150 | {insert(__il.begin(), __il.end());} |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1151 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1152 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1153 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1154 | iterator erase(const_iterator __p) {return __tree_.erase(__p);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1155 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1156 | size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1157 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1158 | iterator erase(const_iterator __f, const_iterator __l) |
| 1159 | {return __tree_.erase(__f, __l);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1160 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1161 | void clear() _NOEXCEPT {__tree_.clear();} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1162 | |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 1163 | #if _LIBCPP_STD_VER > 14 |
| 1164 | _LIBCPP_INLINE_VISIBILITY |
| 1165 | iterator insert(node_type&& __nh) |
| 1166 | { |
| 1167 | _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 1168 | "node_type with incompatible allocator passed to multiset::insert()"); |
| 1169 | return __tree_.template __node_handle_insert_multi<node_type>( |
| 1170 | _VSTD::move(__nh)); |
| 1171 | } |
| 1172 | _LIBCPP_INLINE_VISIBILITY |
| 1173 | iterator insert(const_iterator __hint, node_type&& __nh) |
| 1174 | { |
| 1175 | _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), |
| 1176 | "node_type with incompatible allocator passed to multiset::insert()"); |
| 1177 | return __tree_.template __node_handle_insert_multi<node_type>( |
| 1178 | __hint, _VSTD::move(__nh)); |
| 1179 | } |
| 1180 | _LIBCPP_INLINE_VISIBILITY |
| 1181 | node_type extract(key_type const& __key) |
| 1182 | { |
| 1183 | return __tree_.template __node_handle_extract<node_type>(__key); |
| 1184 | } |
| 1185 | _LIBCPP_INLINE_VISIBILITY |
| 1186 | node_type extract(const_iterator __it) |
| 1187 | { |
| 1188 | return __tree_.template __node_handle_extract<node_type>(__it); |
| 1189 | } |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 1190 | template <class _Compare2> |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 1191 | _LIBCPP_INLINE_VISIBILITY |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 1192 | void merge(multiset<key_type, _Compare2, allocator_type>& __source) |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 1193 | { |
| 1194 | _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), |
| 1195 | "merging container with incompatible allocator"); |
| 1196 | __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1197 | } |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 1198 | template <class _Compare2> |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 1199 | _LIBCPP_INLINE_VISIBILITY |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 1200 | void merge(multiset<key_type, _Compare2, allocator_type>&& __source) |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 1201 | { |
| 1202 | _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), |
| 1203 | "merging container with incompatible allocator"); |
| 1204 | __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1205 | } |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 1206 | template <class _Compare2> |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 1207 | _LIBCPP_INLINE_VISIBILITY |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 1208 | void merge(set<key_type, _Compare2, allocator_type>& __source) |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 1209 | { |
| 1210 | _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), |
| 1211 | "merging container with incompatible allocator"); |
| 1212 | __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1213 | } |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 1214 | template <class _Compare2> |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 1215 | _LIBCPP_INLINE_VISIBILITY |
Louis Dionne | d2322c8 | 2018-11-01 14:41:37 +0000 | [diff] [blame] | 1216 | void merge(set<key_type, _Compare2, allocator_type>&& __source) |
Erik Pilkington | 82a65ad | 2018-10-31 17:31:35 +0000 | [diff] [blame] | 1217 | { |
| 1218 | _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), |
| 1219 | "merging container with incompatible allocator"); |
| 1220 | __tree_.__node_handle_merge_multi(__source.__tree_); |
| 1221 | } |
Erik Pilkington | c37a3d8 | 2018-08-01 01:33:38 +0000 | [diff] [blame] | 1222 | #endif |
| 1223 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1224 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1225 | void swap(multiset& __s) |
| 1226 | _NOEXCEPT_(__is_nothrow_swappable<__base>::value) |
| 1227 | {__tree_.swap(__s.__tree_);} |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1228 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1229 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1230 | allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1231 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1232 | key_compare key_comp() const {return __tree_.value_comp();} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1233 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1234 | value_compare value_comp() const {return __tree_.value_comp();} |
| 1235 | |
| 1236 | // set operations: |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1237 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1238 | iterator find(const key_type& __k) {return __tree_.find(__k);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1239 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1240 | const_iterator find(const key_type& __k) const {return __tree_.find(__k);} |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 1241 | #if _LIBCPP_STD_VER > 11 |
| 1242 | template <typename _K2> |
| 1243 | _LIBCPP_INLINE_VISIBILITY |
| 1244 | typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type |
| 1245 | find(const _K2& __k) {return __tree_.find(__k);} |
| 1246 | template <typename _K2> |
| 1247 | _LIBCPP_INLINE_VISIBILITY |
| 1248 | typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type |
| 1249 | find(const _K2& __k) const {return __tree_.find(__k);} |
| 1250 | #endif |
| 1251 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1252 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1253 | size_type count(const key_type& __k) const |
| 1254 | {return __tree_.__count_multi(__k);} |
Marshall Clow | e6a5f52 | 2014-08-24 23:54:16 +0000 | [diff] [blame] | 1255 | #if _LIBCPP_STD_VER > 11 |
| 1256 | template <typename _K2> |
| 1257 | _LIBCPP_INLINE_VISIBILITY |
| 1258 | typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type |
Marshall Clow | 5571bcd | 2018-01-07 17:39:57 +0000 | [diff] [blame] | 1259 | count(const _K2& __k) const {return __tree_.__count_multi(__k);} |
Marshall Clow | e6a5f52 | 2014-08-24 23:54:16 +0000 | [diff] [blame] | 1260 | #endif |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 1261 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1262 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1263 | iterator lower_bound(const key_type& __k) |
| 1264 | {return __tree_.lower_bound(__k);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1265 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1266 | const_iterator lower_bound(const key_type& __k) const |
| 1267 | {return __tree_.lower_bound(__k);} |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 1268 | #if _LIBCPP_STD_VER > 11 |
| 1269 | template <typename _K2> |
| 1270 | _LIBCPP_INLINE_VISIBILITY |
| 1271 | typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type |
| 1272 | lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} |
| 1273 | |
| 1274 | template <typename _K2> |
| 1275 | _LIBCPP_INLINE_VISIBILITY |
| 1276 | typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type |
| 1277 | lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} |
| 1278 | #endif |
| 1279 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1280 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1281 | iterator upper_bound(const key_type& __k) |
| 1282 | {return __tree_.upper_bound(__k);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1283 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1284 | const_iterator upper_bound(const key_type& __k) const |
| 1285 | {return __tree_.upper_bound(__k);} |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 1286 | #if _LIBCPP_STD_VER > 11 |
| 1287 | template <typename _K2> |
| 1288 | _LIBCPP_INLINE_VISIBILITY |
| 1289 | typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type |
| 1290 | upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} |
| 1291 | template <typename _K2> |
| 1292 | _LIBCPP_INLINE_VISIBILITY |
| 1293 | typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type |
| 1294 | upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} |
| 1295 | #endif |
| 1296 | |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1297 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1298 | pair<iterator,iterator> equal_range(const key_type& __k) |
| 1299 | {return __tree_.__equal_range_multi(__k);} |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1300 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1301 | pair<const_iterator,const_iterator> equal_range(const key_type& __k) const |
| 1302 | {return __tree_.__equal_range_multi(__k);} |
Marshall Clow | c015214 | 2013-08-13 01:11:06 +0000 | [diff] [blame] | 1303 | #if _LIBCPP_STD_VER > 11 |
| 1304 | template <typename _K2> |
| 1305 | _LIBCPP_INLINE_VISIBILITY |
| 1306 | typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type |
| 1307 | equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} |
| 1308 | template <typename _K2> |
| 1309 | _LIBCPP_INLINE_VISIBILITY |
| 1310 | typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type |
| 1311 | equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} |
| 1312 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1313 | }; |
| 1314 | |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1315 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1316 | |
| 1317 | template <class _Key, class _Compare, class _Allocator> |
| 1318 | multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 1319 | : __tree_(_VSTD::move(__s.__tree_), __a) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1320 | { |
| 1321 | if (__a != __s.get_allocator()) |
| 1322 | { |
| 1323 | const_iterator __e = cend(); |
| 1324 | while (!__s.empty()) |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 1325 | insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_)); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1326 | } |
| 1327 | } |
| 1328 | |
Eric Fiselier | 615961b | 2017-04-18 20:58:03 +0000 | [diff] [blame] | 1329 | #endif // _LIBCPP_CXX03_LANG |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1330 | |
| 1331 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1332 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1333 | bool |
| 1334 | operator==(const multiset<_Key, _Compare, _Allocator>& __x, |
| 1335 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 1336 | { |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 1337 | return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1338 | } |
| 1339 | |
| 1340 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1341 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1342 | bool |
| 1343 | operator< (const multiset<_Key, _Compare, _Allocator>& __x, |
| 1344 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 1345 | { |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 1346 | return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1347 | } |
| 1348 | |
| 1349 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1350 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1351 | bool |
| 1352 | operator!=(const multiset<_Key, _Compare, _Allocator>& __x, |
| 1353 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 1354 | { |
| 1355 | return !(__x == __y); |
| 1356 | } |
| 1357 | |
| 1358 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1359 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1360 | bool |
| 1361 | operator> (const multiset<_Key, _Compare, _Allocator>& __x, |
| 1362 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 1363 | { |
| 1364 | return __y < __x; |
| 1365 | } |
| 1366 | |
| 1367 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1368 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1369 | bool |
| 1370 | operator>=(const multiset<_Key, _Compare, _Allocator>& __x, |
| 1371 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 1372 | { |
| 1373 | return !(__x < __y); |
| 1374 | } |
| 1375 | |
| 1376 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1377 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1378 | bool |
| 1379 | operator<=(const multiset<_Key, _Compare, _Allocator>& __x, |
| 1380 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 1381 | { |
| 1382 | return !(__y < __x); |
| 1383 | } |
| 1384 | |
| 1385 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 192cf03 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 1386 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1387 | void |
| 1388 | swap(multiset<_Key, _Compare, _Allocator>& __x, |
| 1389 | multiset<_Key, _Compare, _Allocator>& __y) |
Howard Hinnant | f95f4f5 | 2011-06-04 15:22:34 +0000 | [diff] [blame] | 1390 | _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1391 | { |
| 1392 | __x.swap(__y); |
| 1393 | } |
| 1394 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1395 | _LIBCPP_END_NAMESPACE_STD |
| 1396 | |
| 1397 | #endif // _LIBCPP_SET |