Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===---------------------------- set -------------------------------------===// |
| 3 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
Howard Hinnant | b64f8b0 | 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 | bc8d3f9 | 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; |
| 43 | |
| 44 | // construct/copy/destroy: |
| 45 | explicit set(const value_compare& comp = value_compare()); |
| 46 | set(const value_compare& comp, const allocator_type& a); |
| 47 | template <class InputIterator> |
| 48 | set(InputIterator first, InputIterator last, |
| 49 | const value_compare& comp = value_compare()); |
| 50 | template <class InputIterator> |
| 51 | set(InputIterator first, InputIterator last, const value_compare& comp, |
| 52 | const allocator_type& a); |
| 53 | set(const set& s); |
| 54 | set(set&& s); |
| 55 | explicit set(const allocator_type& a); |
| 56 | set(const set& s, const allocator_type& a); |
| 57 | set(set&& s, const allocator_type& a); |
| 58 | set(initializer_list<value_type> il, const value_compare& comp = value_compare()); |
| 59 | set(initializer_list<value_type> il, const value_compare& comp, |
| 60 | const allocator_type& a); |
| 61 | ~set(); |
| 62 | |
| 63 | set& operator=(const set& s); |
| 64 | set& operator=(set&& s); |
| 65 | set& operator=(initializer_list<value_type> il); |
| 66 | |
| 67 | // iterators: |
| 68 | iterator begin(); |
| 69 | const_iterator begin() const; |
| 70 | iterator end(); |
| 71 | const_iterator end() const; |
| 72 | |
| 73 | reverse_iterator rbegin(); |
| 74 | const_reverse_iterator rbegin() const; |
| 75 | reverse_iterator rend(); |
| 76 | const_reverse_iterator rend() const; |
| 77 | |
| 78 | const_iterator cbegin() const; |
| 79 | const_iterator cend() const; |
| 80 | const_reverse_iterator crbegin() const; |
| 81 | const_reverse_iterator crend() const; |
| 82 | |
| 83 | // capacity: |
| 84 | bool empty() const; |
| 85 | size_type size() const; |
| 86 | size_type max_size() const; |
| 87 | |
| 88 | // modifiers: |
| 89 | template <class... Args> |
| 90 | pair<iterator, bool> emplace(Args&&... args); |
| 91 | template <class... Args> |
| 92 | iterator emplace_hint(const_iterator position, Args&&... args); |
| 93 | pair<iterator,bool> insert(const value_type& v); |
| 94 | pair<iterator,bool> insert(value_type&& v); |
| 95 | iterator insert(const_iterator position, const value_type& v); |
| 96 | iterator insert(const_iterator position, value_type&& v); |
| 97 | template <class InputIterator> |
| 98 | void insert(InputIterator first, InputIterator last); |
| 99 | void insert(initializer_list<value_type> il); |
| 100 | |
| 101 | iterator erase(const_iterator position); |
| 102 | size_type erase(const key_type& k); |
| 103 | iterator erase(const_iterator first, const_iterator last); |
| 104 | void clear(); |
| 105 | |
| 106 | void swap(set& s); |
| 107 | |
| 108 | // observers: |
| 109 | allocator_type get_allocator() const; |
| 110 | key_compare key_comp() const; |
| 111 | value_compare value_comp() const; |
| 112 | |
| 113 | // set operations: |
| 114 | iterator find(const key_type& k); |
| 115 | const_iterator find(const key_type& k) const; |
| 116 | size_type count(const key_type& k) const; |
| 117 | iterator lower_bound(const key_type& k); |
| 118 | const_iterator lower_bound(const key_type& k) const; |
| 119 | iterator upper_bound(const key_type& k); |
| 120 | const_iterator upper_bound(const key_type& k) const; |
| 121 | pair<iterator,iterator> equal_range(const key_type& k); |
| 122 | pair<const_iterator,const_iterator> equal_range(const key_type& k) const; |
| 123 | }; |
| 124 | |
| 125 | template <class Key, class Compare, class Allocator> |
| 126 | bool |
| 127 | operator==(const set<Key, Compare, Allocator>& x, |
| 128 | const set<Key, Compare, Allocator>& y); |
| 129 | |
| 130 | template <class Key, class Compare, class Allocator> |
| 131 | bool |
| 132 | operator< (const set<Key, Compare, Allocator>& x, |
| 133 | const set<Key, Compare, Allocator>& y); |
| 134 | |
| 135 | template <class Key, class Compare, class Allocator> |
| 136 | bool |
| 137 | operator!=(const set<Key, Compare, Allocator>& x, |
| 138 | const set<Key, Compare, Allocator>& y); |
| 139 | |
| 140 | template <class Key, class Compare, class Allocator> |
| 141 | bool |
| 142 | operator> (const set<Key, Compare, Allocator>& x, |
| 143 | const set<Key, Compare, Allocator>& y); |
| 144 | |
| 145 | template <class Key, class Compare, class Allocator> |
| 146 | bool |
| 147 | operator>=(const set<Key, Compare, Allocator>& x, |
| 148 | const set<Key, Compare, Allocator>& y); |
| 149 | |
| 150 | template <class Key, class Compare, class Allocator> |
| 151 | bool |
| 152 | operator<=(const set<Key, Compare, Allocator>& x, |
| 153 | const set<Key, Compare, Allocator>& y); |
| 154 | |
| 155 | // specialized algorithms: |
| 156 | template <class Key, class Compare, class Allocator> |
| 157 | void |
| 158 | swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y); |
| 159 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 160 | template <class Key, class Compare = less<Key>, |
| 161 | class Allocator = allocator<Key>> |
| 162 | class multiset |
| 163 | { |
| 164 | public: |
| 165 | // types: |
| 166 | typedef Key key_type; |
| 167 | typedef key_type value_type; |
| 168 | typedef Compare key_compare; |
| 169 | typedef key_compare value_compare; |
| 170 | typedef Allocator allocator_type; |
| 171 | typedef typename allocator_type::reference reference; |
| 172 | typedef typename allocator_type::const_reference const_reference; |
| 173 | typedef typename allocator_type::size_type size_type; |
| 174 | typedef typename allocator_type::difference_type difference_type; |
| 175 | typedef typename allocator_type::pointer pointer; |
| 176 | typedef typename allocator_type::const_pointer const_pointer; |
| 177 | |
| 178 | typedef implementation-defined iterator; |
| 179 | typedef implementation-defined const_iterator; |
| 180 | typedef std::reverse_iterator<iterator> reverse_iterator; |
| 181 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; |
| 182 | |
| 183 | // construct/copy/destroy: |
| 184 | explicit multiset(const value_compare& comp = value_compare()); |
| 185 | multiset(const value_compare& comp, const allocator_type& a); |
| 186 | template <class InputIterator> |
| 187 | multiset(InputIterator first, InputIterator last, |
| 188 | const value_compare& comp = value_compare()); |
| 189 | template <class InputIterator> |
| 190 | multiset(InputIterator first, InputIterator last, |
| 191 | const value_compare& comp, const allocator_type& a); |
| 192 | multiset(const multiset& s); |
| 193 | multiset(multiset&& s); |
| 194 | explicit multiset(const allocator_type& a); |
| 195 | multiset(const multiset& s, const allocator_type& a); |
| 196 | multiset(multiset&& s, const allocator_type& a); |
| 197 | multiset(initializer_list<value_type> il, const value_compare& comp = value_compare()); |
| 198 | multiset(initializer_list<value_type> il, const value_compare& comp, |
| 199 | const allocator_type& a); |
| 200 | ~multiset(); |
| 201 | |
| 202 | multiset& operator=(const multiset& s); |
| 203 | multiset& operator=(multiset&& s); |
| 204 | multiset& operator=(initializer_list<value_type> il); |
| 205 | |
| 206 | // iterators: |
| 207 | iterator begin(); |
| 208 | const_iterator begin() const; |
| 209 | iterator end(); |
| 210 | const_iterator end() const; |
| 211 | |
| 212 | reverse_iterator rbegin(); |
| 213 | const_reverse_iterator rbegin() const; |
| 214 | reverse_iterator rend(); |
| 215 | const_reverse_iterator rend() const; |
| 216 | |
| 217 | const_iterator cbegin() const; |
| 218 | const_iterator cend() const; |
| 219 | const_reverse_iterator crbegin() const; |
| 220 | const_reverse_iterator crend() const; |
| 221 | |
| 222 | // capacity: |
| 223 | bool empty() const; |
| 224 | size_type size() const; |
| 225 | size_type max_size() const; |
| 226 | |
| 227 | // modifiers: |
| 228 | template <class... Args> |
| 229 | iterator emplace(Args&&... args); |
| 230 | template <class... Args> |
| 231 | iterator emplace_hint(const_iterator position, Args&&... args); |
| 232 | iterator insert(const value_type& v); |
| 233 | iterator insert(value_type&& v); |
| 234 | iterator insert(const_iterator position, const value_type& v); |
| 235 | iterator insert(const_iterator position, value_type&& v); |
| 236 | template <class InputIterator> |
| 237 | void insert(InputIterator first, InputIterator last); |
| 238 | void insert(initializer_list<value_type> il); |
| 239 | |
| 240 | iterator erase(const_iterator position); |
| 241 | size_type erase(const key_type& k); |
| 242 | iterator erase(const_iterator first, const_iterator last); |
| 243 | void clear(); |
| 244 | |
| 245 | void swap(multiset& s); |
| 246 | |
| 247 | // observers: |
| 248 | allocator_type get_allocator() const; |
| 249 | key_compare key_comp() const; |
| 250 | value_compare value_comp() const; |
| 251 | |
| 252 | // set operations: |
| 253 | iterator find(const key_type& k); |
| 254 | const_iterator find(const key_type& k) const; |
| 255 | size_type count(const key_type& k) const; |
| 256 | iterator lower_bound(const key_type& k); |
| 257 | const_iterator lower_bound(const key_type& k) const; |
| 258 | iterator upper_bound(const key_type& k); |
| 259 | const_iterator upper_bound(const key_type& k) const; |
| 260 | pair<iterator,iterator> equal_range(const key_type& k); |
| 261 | pair<const_iterator,const_iterator> equal_range(const key_type& k) const; |
| 262 | }; |
| 263 | |
| 264 | template <class Key, class Compare, class Allocator> |
| 265 | bool |
| 266 | operator==(const multiset<Key, Compare, Allocator>& x, |
| 267 | const multiset<Key, Compare, Allocator>& y); |
| 268 | |
| 269 | template <class Key, class Compare, class Allocator> |
| 270 | bool |
| 271 | operator< (const multiset<Key, Compare, Allocator>& x, |
| 272 | const multiset<Key, Compare, Allocator>& y); |
| 273 | |
| 274 | template <class Key, class Compare, class Allocator> |
| 275 | bool |
| 276 | operator!=(const multiset<Key, Compare, Allocator>& x, |
| 277 | const multiset<Key, Compare, Allocator>& y); |
| 278 | |
| 279 | template <class Key, class Compare, class Allocator> |
| 280 | bool |
| 281 | operator> (const multiset<Key, Compare, Allocator>& x, |
| 282 | const multiset<Key, Compare, Allocator>& y); |
| 283 | |
| 284 | template <class Key, class Compare, class Allocator> |
| 285 | bool |
| 286 | operator>=(const multiset<Key, Compare, Allocator>& x, |
| 287 | const multiset<Key, Compare, Allocator>& y); |
| 288 | |
| 289 | template <class Key, class Compare, class Allocator> |
| 290 | bool |
| 291 | operator<=(const multiset<Key, Compare, Allocator>& x, |
| 292 | const multiset<Key, Compare, Allocator>& y); |
| 293 | |
| 294 | // specialized algorithms: |
| 295 | template <class Key, class Compare, class Allocator> |
| 296 | void |
| 297 | swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y); |
| 298 | |
| 299 | } // std |
| 300 | |
| 301 | */ |
| 302 | |
| 303 | #include <__config> |
| 304 | #include <__tree> |
| 305 | #include <functional> |
| 306 | |
| 307 | #pragma GCC system_header |
| 308 | |
| 309 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 310 | |
| 311 | template <class _Key, class _Compare = less<_Key>, |
| 312 | class _Allocator = allocator<_Key> > |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 313 | class _LIBCPP_VISIBLE set |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 314 | { |
| 315 | public: |
| 316 | // types: |
| 317 | typedef _Key key_type; |
| 318 | typedef key_type value_type; |
| 319 | typedef _Compare key_compare; |
| 320 | typedef key_compare value_compare; |
| 321 | typedef _Allocator allocator_type; |
| 322 | typedef value_type& reference; |
| 323 | typedef const value_type& const_reference; |
| 324 | |
| 325 | private: |
| 326 | typedef __tree<value_type, value_compare, allocator_type> __base; |
| 327 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 328 | typedef typename __base::__node_holder __node_holder; |
| 329 | |
| 330 | __base __tree_; |
| 331 | |
| 332 | public: |
| 333 | typedef typename __base::pointer pointer; |
| 334 | typedef typename __base::const_pointer const_pointer; |
| 335 | typedef typename __base::size_type size_type; |
| 336 | typedef typename __base::difference_type difference_type; |
| 337 | typedef typename __base::const_iterator iterator; |
| 338 | typedef typename __base::const_iterator const_iterator; |
| 339 | typedef _STD::reverse_iterator<iterator> reverse_iterator; |
| 340 | typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator; |
| 341 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 342 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 343 | explicit set(const value_compare& __comp = value_compare()) |
| 344 | : __tree_(__comp) {} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 345 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 346 | set(const value_compare& __comp, const allocator_type& __a) |
| 347 | : __tree_(__comp, __a) {} |
| 348 | template <class _InputIterator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 349 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 350 | set(_InputIterator __f, _InputIterator __l, |
| 351 | const value_compare& __comp = value_compare()) |
| 352 | : __tree_(__comp) |
| 353 | { |
| 354 | insert(__f, __l); |
| 355 | } |
| 356 | |
| 357 | template <class _InputIterator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 358 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 359 | set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, |
| 360 | const allocator_type& __a) |
| 361 | : __tree_(__comp, __a) |
| 362 | { |
| 363 | insert(__f, __l); |
| 364 | } |
| 365 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 366 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 367 | set(const set& __s) |
| 368 | : __tree_(__s.__tree_) |
| 369 | { |
| 370 | insert(__s.begin(), __s.end()); |
| 371 | } |
| 372 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 373 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 374 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 375 | set(set&& __s) |
| 376 | : __tree_(_STD::move(__s.__tree_)) {} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 377 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 378 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 379 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 380 | explicit set(const allocator_type& __a) |
| 381 | : __tree_(__a) {} |
| 382 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 383 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 384 | set(const set& __s, const allocator_type& __a) |
| 385 | : __tree_(__s.__tree_.value_comp(), __a) |
| 386 | { |
| 387 | insert(__s.begin(), __s.end()); |
| 388 | } |
| 389 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 390 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 391 | set(set&& __s, const allocator_type& __a); |
| 392 | #endif |
| 393 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 394 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 395 | set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) |
| 396 | : __tree_(__comp) |
| 397 | { |
| 398 | insert(__il.begin(), __il.end()); |
| 399 | } |
| 400 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 401 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 402 | set(initializer_list<value_type> __il, const value_compare& __comp, |
| 403 | const allocator_type& __a) |
| 404 | : __tree_(__comp, __a) |
| 405 | { |
| 406 | insert(__il.begin(), __il.end()); |
| 407 | } |
| 408 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 409 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 410 | set& operator=(initializer_list<value_type> __il) |
| 411 | { |
| 412 | __tree_.__assign_unique(__il.begin(), __il.end()); |
| 413 | return *this; |
| 414 | } |
| 415 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 416 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 417 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 418 | set& operator=(set&& __s) |
| 419 | { |
| 420 | __tree_ = _STD::move(__s.__tree_); |
| 421 | return *this; |
| 422 | } |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 423 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 424 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 425 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 426 | iterator begin() {return __tree_.begin();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 427 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 428 | const_iterator begin() const {return __tree_.begin();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 429 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 430 | iterator end() {return __tree_.end();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 431 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 432 | const_iterator end() const {return __tree_.end();} |
| 433 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 434 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 435 | reverse_iterator rbegin() {return reverse_iterator(end());} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 436 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 437 | const_reverse_iterator rbegin() const {return const_reverse_iterator(end());} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 438 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 439 | reverse_iterator rend() {return reverse_iterator(begin());} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 440 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 441 | const_reverse_iterator rend() const {return const_reverse_iterator(begin());} |
| 442 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 443 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 444 | const_iterator cbegin() const {return begin();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 445 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 446 | const_iterator cend() const {return end();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 447 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 448 | const_reverse_iterator crbegin() const {return rbegin();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 449 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 450 | const_reverse_iterator crend() const {return rend();} |
| 451 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 452 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 453 | bool empty() const {return __tree_.size() == 0;} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 454 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 455 | size_type size() const {return __tree_.size();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 456 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 457 | size_type max_size() const {return __tree_.max_size();} |
| 458 | |
| 459 | // modifiers: |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 460 | #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 461 | template <class... _Args> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 462 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 463 | pair<iterator, bool> emplace(_Args&&... __args) |
| 464 | {return __tree_.__emplace_unique(_STD::forward<_Args>(__args)...);} |
| 465 | template <class... _Args> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 466 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 467 | iterator emplace_hint(const_iterator __p, _Args&&... __args) |
| 468 | {return __tree_.__emplace_hint_unique(__p, _STD::forward<_Args>(__args)...);} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 469 | #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 470 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 471 | pair<iterator,bool> insert(const value_type& __v) |
| 472 | {return __tree_.__insert_unique(__v);} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 473 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 474 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 475 | pair<iterator,bool> insert(value_type&& __v) |
| 476 | {return __tree_.__insert_unique(_STD::move(__v));} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 477 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 478 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 479 | iterator insert(const_iterator __p, const value_type& __v) |
| 480 | {return __tree_.__insert_unique(__p, __v);} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 481 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 482 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 483 | iterator insert(const_iterator __p, value_type&& __v) |
| 484 | {return __tree_.__insert_unique(__p, _STD::move(__v));} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 485 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 486 | template <class _InputIterator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 487 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 488 | void insert(_InputIterator __f, _InputIterator __l) |
| 489 | { |
| 490 | for (const_iterator __e = cend(); __f != __l; ++__f) |
| 491 | __tree_.__insert_unique(__e, *__f); |
| 492 | } |
| 493 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 494 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 495 | void insert(initializer_list<value_type> __il) |
| 496 | {insert(__il.begin(), __il.end());} |
| 497 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 498 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 499 | iterator erase(const_iterator __p) {return __tree_.erase(__p);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 500 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 501 | size_type erase(const key_type& __k) |
| 502 | {return __tree_.__erase_unique(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 503 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 504 | iterator erase(const_iterator __f, const_iterator __l) |
| 505 | {return __tree_.erase(__f, __l);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 506 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 507 | void clear() {__tree_.clear();} |
| 508 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 509 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 510 | void swap(set& __s) {__tree_.swap(__s.__tree_);} |
| 511 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 512 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 513 | allocator_type get_allocator() const {return __tree_.__alloc();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 514 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 515 | key_compare key_comp() const {return __tree_.value_comp();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 516 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 517 | value_compare value_comp() const {return __tree_.value_comp();} |
| 518 | |
| 519 | // set operations: |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 520 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 521 | iterator find(const key_type& __k) {return __tree_.find(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 522 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 523 | const_iterator find(const key_type& __k) const {return __tree_.find(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 524 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 525 | size_type count(const key_type& __k) const |
| 526 | {return __tree_.__count_unique(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 527 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 528 | iterator lower_bound(const key_type& __k) |
| 529 | {return __tree_.lower_bound(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 530 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 531 | const_iterator lower_bound(const key_type& __k) const |
| 532 | {return __tree_.lower_bound(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 533 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 534 | iterator upper_bound(const key_type& __k) |
| 535 | {return __tree_.upper_bound(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 536 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 537 | const_iterator upper_bound(const key_type& __k) const |
| 538 | {return __tree_.upper_bound(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 539 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 540 | pair<iterator,iterator> equal_range(const key_type& __k) |
| 541 | {return __tree_.__equal_range_unique(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 542 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 543 | pair<const_iterator,const_iterator> equal_range(const key_type& __k) const |
| 544 | {return __tree_.__equal_range_unique(__k);} |
| 545 | }; |
| 546 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 547 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 548 | |
| 549 | template <class _Key, class _Compare, class _Allocator> |
| 550 | set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) |
| 551 | : __tree_(_STD::move(__s.__tree_), __a) |
| 552 | { |
| 553 | if (__a != __s.get_allocator()) |
| 554 | { |
| 555 | const_iterator __e = cend(); |
| 556 | while (!__s.empty()) |
| 557 | insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_)); |
| 558 | } |
| 559 | } |
| 560 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 561 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 562 | |
| 563 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 564 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 565 | bool |
| 566 | operator==(const set<_Key, _Compare, _Allocator>& __x, |
| 567 | const set<_Key, _Compare, _Allocator>& __y) |
| 568 | { |
| 569 | return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin()); |
| 570 | } |
| 571 | |
| 572 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 573 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 574 | bool |
| 575 | operator< (const set<_Key, _Compare, _Allocator>& __x, |
| 576 | const set<_Key, _Compare, _Allocator>& __y) |
| 577 | { |
| 578 | return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); |
| 579 | } |
| 580 | |
| 581 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 582 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 583 | bool |
| 584 | operator!=(const set<_Key, _Compare, _Allocator>& __x, |
| 585 | const set<_Key, _Compare, _Allocator>& __y) |
| 586 | { |
| 587 | return !(__x == __y); |
| 588 | } |
| 589 | |
| 590 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 591 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 592 | bool |
| 593 | operator> (const set<_Key, _Compare, _Allocator>& __x, |
| 594 | const set<_Key, _Compare, _Allocator>& __y) |
| 595 | { |
| 596 | return __y < __x; |
| 597 | } |
| 598 | |
| 599 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 600 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 601 | bool |
| 602 | operator>=(const set<_Key, _Compare, _Allocator>& __x, |
| 603 | const set<_Key, _Compare, _Allocator>& __y) |
| 604 | { |
| 605 | return !(__x < __y); |
| 606 | } |
| 607 | |
| 608 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 609 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 610 | bool |
| 611 | operator<=(const set<_Key, _Compare, _Allocator>& __x, |
| 612 | const set<_Key, _Compare, _Allocator>& __y) |
| 613 | { |
| 614 | return !(__y < __x); |
| 615 | } |
| 616 | |
| 617 | // specialized algorithms: |
| 618 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 619 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 620 | void |
| 621 | swap(set<_Key, _Compare, _Allocator>& __x, |
| 622 | set<_Key, _Compare, _Allocator>& __y) |
| 623 | { |
| 624 | __x.swap(__y); |
| 625 | } |
| 626 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 627 | template <class _Key, class _Compare = less<_Key>, |
| 628 | class _Allocator = allocator<_Key> > |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 629 | class _LIBCPP_VISIBLE multiset |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 630 | { |
| 631 | public: |
| 632 | // types: |
| 633 | typedef _Key key_type; |
| 634 | typedef key_type value_type; |
| 635 | typedef _Compare key_compare; |
| 636 | typedef key_compare value_compare; |
| 637 | typedef _Allocator allocator_type; |
| 638 | typedef value_type& reference; |
| 639 | typedef const value_type& const_reference; |
| 640 | |
| 641 | private: |
| 642 | typedef __tree<value_type, value_compare, allocator_type> __base; |
| 643 | typedef allocator_traits<allocator_type> __alloc_traits; |
| 644 | typedef typename __base::__node_holder __node_holder; |
| 645 | |
| 646 | __base __tree_; |
| 647 | |
| 648 | public: |
| 649 | typedef typename __base::pointer pointer; |
| 650 | typedef typename __base::const_pointer const_pointer; |
| 651 | typedef typename __base::size_type size_type; |
| 652 | typedef typename __base::difference_type difference_type; |
| 653 | typedef typename __base::const_iterator iterator; |
| 654 | typedef typename __base::const_iterator const_iterator; |
| 655 | typedef _STD::reverse_iterator<iterator> reverse_iterator; |
| 656 | typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator; |
| 657 | |
| 658 | // construct/copy/destroy: |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 659 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 660 | explicit multiset(const value_compare& __comp = value_compare()) |
| 661 | : __tree_(__comp) {} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 662 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 663 | multiset(const value_compare& __comp, const allocator_type& __a) |
| 664 | : __tree_(__comp, __a) {} |
| 665 | template <class _InputIterator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 666 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 667 | multiset(_InputIterator __f, _InputIterator __l, |
| 668 | const value_compare& __comp = value_compare()) |
| 669 | : __tree_(__comp) |
| 670 | { |
| 671 | insert(__f, __l); |
| 672 | } |
| 673 | |
| 674 | template <class _InputIterator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 675 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 676 | multiset(_InputIterator __f, _InputIterator __l, |
| 677 | const value_compare& __comp, const allocator_type& __a) |
| 678 | : __tree_(__comp, __a) |
| 679 | { |
| 680 | insert(__f, __l); |
| 681 | } |
| 682 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 683 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 684 | multiset(const multiset& __s) |
| 685 | : __tree_(__s.__tree_.value_comp(), |
| 686 | __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc())) |
| 687 | { |
| 688 | insert(__s.begin(), __s.end()); |
| 689 | } |
| 690 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 691 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 692 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 693 | multiset(multiset&& __s) |
| 694 | : __tree_(_STD::move(__s.__tree_)) {} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 695 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 696 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 697 | explicit multiset(const allocator_type& __a) |
| 698 | : __tree_(__a) {} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 699 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 700 | multiset(const multiset& __s, const allocator_type& __a) |
| 701 | : __tree_(__s.__tree_.value_comp(), __a) |
| 702 | { |
| 703 | insert(__s.begin(), __s.end()); |
| 704 | } |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 705 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 706 | multiset(multiset&& __s, const allocator_type& __a); |
| 707 | #endif |
| 708 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 709 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 710 | multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) |
| 711 | : __tree_(__comp) |
| 712 | { |
| 713 | insert(__il.begin(), __il.end()); |
| 714 | } |
| 715 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 716 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 717 | multiset(initializer_list<value_type> __il, const value_compare& __comp, |
| 718 | const allocator_type& __a) |
| 719 | : __tree_(__comp, __a) |
| 720 | { |
| 721 | insert(__il.begin(), __il.end()); |
| 722 | } |
| 723 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 724 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 725 | multiset& operator=(initializer_list<value_type> __il) |
| 726 | { |
| 727 | __tree_.__assign_multi(__il.begin(), __il.end()); |
| 728 | return *this; |
| 729 | } |
| 730 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 731 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 732 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 733 | multiset& operator=(multiset&& __s) |
| 734 | { |
| 735 | __tree_ = _STD::move(__s.__tree_); |
| 736 | return *this; |
| 737 | } |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 738 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 739 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 740 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 741 | iterator begin() {return __tree_.begin();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 742 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 743 | const_iterator begin() const {return __tree_.begin();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 744 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 745 | iterator end() {return __tree_.end();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 746 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 747 | const_iterator end() const {return __tree_.end();} |
| 748 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 749 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 750 | reverse_iterator rbegin() {return reverse_iterator(end());} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 751 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 752 | const_reverse_iterator rbegin() const {return const_reverse_iterator(end());} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 753 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 754 | reverse_iterator rend() {return reverse_iterator(begin());} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 755 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 756 | const_reverse_iterator rend() const {return const_reverse_iterator(begin());} |
| 757 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 758 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 759 | const_iterator cbegin() const {return begin();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 760 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 761 | const_iterator cend() const {return end();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 762 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 763 | const_reverse_iterator crbegin() const {return rbegin();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 764 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 765 | const_reverse_iterator crend() const {return rend();} |
| 766 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 767 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 768 | bool empty() const {return __tree_.size() == 0;} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 769 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 770 | size_type size() const {return __tree_.size();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 771 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 772 | size_type max_size() const {return __tree_.max_size();} |
| 773 | |
| 774 | // modifiers: |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 775 | #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 776 | template <class... _Args> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 777 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 778 | iterator emplace(_Args&&... __args) |
| 779 | {return __tree_.__emplace_multi(_STD::forward<_Args>(__args)...);} |
| 780 | template <class... _Args> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 781 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 782 | iterator emplace_hint(const_iterator __p, _Args&&... __args) |
| 783 | {return __tree_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 784 | #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 785 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 786 | iterator insert(const value_type& __v) |
| 787 | {return __tree_.__insert_multi(__v);} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 788 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 789 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 790 | iterator insert(value_type&& __v) |
| 791 | {return __tree_.__insert_multi(_STD::move(__v));} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 792 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 793 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 794 | iterator insert(const_iterator __p, const value_type& __v) |
| 795 | {return __tree_.__insert_multi(__p, __v);} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 796 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 797 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 798 | iterator insert(const_iterator __p, value_type&& __v) |
| 799 | {return __tree_.__insert_multi(_STD::move(__v));} |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 800 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 801 | template <class _InputIterator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 802 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 803 | void insert(_InputIterator __f, _InputIterator __l) |
| 804 | { |
| 805 | for (const_iterator __e = cend(); __f != __l; ++__f) |
| 806 | __tree_.__insert_multi(__e, *__f); |
| 807 | } |
| 808 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 809 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 810 | void insert(initializer_list<value_type> __il) |
| 811 | {insert(__il.begin(), __il.end());} |
| 812 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 813 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 814 | iterator erase(const_iterator __p) {return __tree_.erase(__p);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 815 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 816 | size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 817 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 818 | iterator erase(const_iterator __f, const_iterator __l) |
| 819 | {return __tree_.erase(__f, __l);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 820 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 821 | void clear() {__tree_.clear();} |
| 822 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 823 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 824 | void swap(multiset& __s) {__tree_.swap(__s.__tree_);} |
| 825 | |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 826 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 827 | allocator_type get_allocator() const {return __tree_.__alloc();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 828 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 829 | key_compare key_comp() const {return __tree_.value_comp();} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 830 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 831 | value_compare value_comp() const {return __tree_.value_comp();} |
| 832 | |
| 833 | // set operations: |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 834 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 835 | iterator find(const key_type& __k) {return __tree_.find(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 836 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 837 | const_iterator find(const key_type& __k) const {return __tree_.find(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 838 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 839 | size_type count(const key_type& __k) const |
| 840 | {return __tree_.__count_multi(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 841 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 842 | iterator lower_bound(const key_type& __k) |
| 843 | {return __tree_.lower_bound(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 844 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 845 | const_iterator lower_bound(const key_type& __k) const |
| 846 | {return __tree_.lower_bound(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 847 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 848 | iterator upper_bound(const key_type& __k) |
| 849 | {return __tree_.upper_bound(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 850 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 851 | const_iterator upper_bound(const key_type& __k) const |
| 852 | {return __tree_.upper_bound(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 853 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 854 | pair<iterator,iterator> equal_range(const key_type& __k) |
| 855 | {return __tree_.__equal_range_multi(__k);} |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 856 | _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 857 | pair<const_iterator,const_iterator> equal_range(const key_type& __k) const |
| 858 | {return __tree_.__equal_range_multi(__k);} |
| 859 | }; |
| 860 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 861 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 862 | |
| 863 | template <class _Key, class _Compare, class _Allocator> |
| 864 | multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) |
| 865 | : __tree_(_STD::move(__s.__tree_), __a) |
| 866 | { |
| 867 | if (__a != __s.get_allocator()) |
| 868 | { |
| 869 | const_iterator __e = cend(); |
| 870 | while (!__s.empty()) |
| 871 | insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_)); |
| 872 | } |
| 873 | } |
| 874 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 875 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 876 | |
| 877 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 878 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 879 | bool |
| 880 | operator==(const multiset<_Key, _Compare, _Allocator>& __x, |
| 881 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 882 | { |
| 883 | return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin()); |
| 884 | } |
| 885 | |
| 886 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 887 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 888 | bool |
| 889 | operator< (const multiset<_Key, _Compare, _Allocator>& __x, |
| 890 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 891 | { |
| 892 | return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); |
| 893 | } |
| 894 | |
| 895 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 896 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 897 | bool |
| 898 | operator!=(const multiset<_Key, _Compare, _Allocator>& __x, |
| 899 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 900 | { |
| 901 | return !(__x == __y); |
| 902 | } |
| 903 | |
| 904 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 905 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 906 | bool |
| 907 | operator> (const multiset<_Key, _Compare, _Allocator>& __x, |
| 908 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 909 | { |
| 910 | return __y < __x; |
| 911 | } |
| 912 | |
| 913 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 914 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 915 | bool |
| 916 | operator>=(const multiset<_Key, _Compare, _Allocator>& __x, |
| 917 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 918 | { |
| 919 | return !(__x < __y); |
| 920 | } |
| 921 | |
| 922 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 923 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 924 | bool |
| 925 | operator<=(const multiset<_Key, _Compare, _Allocator>& __x, |
| 926 | const multiset<_Key, _Compare, _Allocator>& __y) |
| 927 | { |
| 928 | return !(__y < __x); |
| 929 | } |
| 930 | |
| 931 | template <class _Key, class _Compare, class _Allocator> |
Howard Hinnant | 28c97e6 | 2010-09-23 16:27:36 +0000 | [diff] [blame] | 932 | inline _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 933 | void |
| 934 | swap(multiset<_Key, _Compare, _Allocator>& __x, |
| 935 | multiset<_Key, _Compare, _Allocator>& __y) |
| 936 | { |
| 937 | __x.swap(__y); |
| 938 | } |
| 939 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 940 | _LIBCPP_END_NAMESPACE_STD |
| 941 | |
| 942 | #endif // _LIBCPP_SET |