codekingpro/portable-devtools
114k
1// -*- C++ -*-2//===-------------------------- unordered_set -----------------------------===//3//4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCUDACXX_UNORDERED_SET11#define _LIBCUDACXX_UNORDERED_SET12 13/*14 15 unordered_set synopsis16 17#include <initializer_list>18 19namespace std20{21 22template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,23 class Alloc = allocator<Value>>24class unordered_set25{26public:27 // types28 typedef Value key_type;29 typedef key_type value_type;30 typedef Hash hasher;31 typedef Pred key_equal;32 typedef Alloc allocator_type;33 typedef value_type& reference;34 typedef const value_type& const_reference;35 typedef typename allocator_traits<allocator_type>::pointer pointer;36 typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;37 typedef typename allocator_traits<allocator_type>::size_type size_type;38 typedef typename allocator_traits<allocator_type>::difference_type difference_type;39 40 typedef /unspecified/ iterator;41 typedef /unspecified/ const_iterator;42 typedef /unspecified/ local_iterator;43 typedef /unspecified/ const_local_iterator;44 45 typedef unspecified node_type unspecified; // C++1746 typedef INSERT_RETURN_TYPE<iterator, node_type> insert_return_type; // C++1747 48 unordered_set()49 noexcept(50 is_nothrow_default_constructible<hasher>::value &&51 is_nothrow_default_constructible<key_equal>::value &&52 is_nothrow_default_constructible<allocator_type>::value);53 explicit unordered_set(size_type n, const hasher& hf = hasher(),54 const key_equal& eql = key_equal(),55 const allocator_type& a = allocator_type());56 template <class InputIterator>57 unordered_set(InputIterator f, InputIterator l,58 size_type n = 0, const hasher& hf = hasher(),59 const key_equal& eql = key_equal(),60 const allocator_type& a = allocator_type());61 explicit unordered_set(const allocator_type&);62 unordered_set(const unordered_set&);63 unordered_set(const unordered_set&, const Allocator&);64 unordered_set(unordered_set&&)65 noexcept(66 is_nothrow_move_constructible<hasher>::value &&67 is_nothrow_move_constructible<key_equal>::value &&68 is_nothrow_move_constructible<allocator_type>::value);69 unordered_set(unordered_set&&, const Allocator&);70 unordered_set(initializer_list<value_type>, size_type n = 0,71 const hasher& hf = hasher(), const key_equal& eql = key_equal(),72 const allocator_type& a = allocator_type());73 unordered_set(size_type n, const allocator_type& a); // C++1474 unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++1475 template <class InputIterator>76 unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++1477 template <class InputIterator>78 unordered_set(InputIterator f, InputIterator l, size_type n,79 const hasher& hf, const allocator_type& a); // C++1480 unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++1481 unordered_set(initializer_list<value_type> il, size_type n,82 const hasher& hf, const allocator_type& a); // C++1483 ~unordered_set();84 unordered_set& operator=(const unordered_set&);85 unordered_set& operator=(unordered_set&&)86 noexcept(87 allocator_type::propagate_on_container_move_assignment::value &&88 is_nothrow_move_assignable<allocator_type>::value &&89 is_nothrow_move_assignable<hasher>::value &&90 is_nothrow_move_assignable<key_equal>::value);91 unordered_set& operator=(initializer_list<value_type>);92 93 allocator_type get_allocator() const noexcept;94 95 bool empty() const noexcept;96 size_type size() const noexcept;97 size_type max_size() const noexcept;98 99 iterator begin() noexcept;100 iterator end() noexcept;101 const_iterator begin() const noexcept;102 const_iterator end() const noexcept;103 const_iterator cbegin() const noexcept;104 const_iterator cend() const noexcept;105 106 template <class... Args>107 pair<iterator, bool> emplace(Args&&... args);108 template <class... Args>109 iterator emplace_hint(const_iterator position, Args&&... args);110 pair<iterator, bool> insert(const value_type& obj);111 pair<iterator, bool> insert(value_type&& obj);112 iterator insert(const_iterator hint, const value_type& obj);113 iterator insert(const_iterator hint, value_type&& obj);114 template <class InputIterator>115 void insert(InputIterator first, InputIterator last);116 void insert(initializer_list<value_type>);117 118 node_type extract(const_iterator position); // C++17119 node_type extract(const key_type& x); // C++17120 insert_return_type insert(node_type&& nh); // C++17121 iterator insert(const_iterator hint, node_type&& nh); // C++17122 123 iterator erase(const_iterator position);124 iterator erase(iterator position); // C++14125 size_type erase(const key_type& k);126 iterator erase(const_iterator first, const_iterator last);127 void clear() noexcept;128 129 template<class H2, class P2>130 void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17131 template<class H2, class P2>132 void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17133 template<class H2, class P2>134 void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17135 template<class H2, class P2>136 void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17137 138 void swap(unordered_set&)139 noexcept(allocator_traits<Allocator>::is_always_equal::value &&140 noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&141 noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17142 143 hasher hash_function() const;144 key_equal key_eq() const;145 146 iterator find(const key_type& k);147 const_iterator find(const key_type& k) const;148 size_type count(const key_type& k) const;149 bool contains(const key_type& k) const; // C++20150 pair<iterator, iterator> equal_range(const key_type& k);151 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;152 153 size_type bucket_count() const noexcept;154 size_type max_bucket_count() const noexcept;155 156 size_type bucket_size(size_type n) const;157 size_type bucket(const key_type& k) const;158 159 local_iterator begin(size_type n);160 local_iterator end(size_type n);161 const_local_iterator begin(size_type n) const;162 const_local_iterator end(size_type n) const;163 const_local_iterator cbegin(size_type n) const;164 const_local_iterator cend(size_type n) const;165 166 float load_factor() const noexcept;167 float max_load_factor() const noexcept;168 void max_load_factor(float z);169 void rehash(size_type n);170 void reserve(size_type n);171};172 173template <class Value, class Hash, class Pred, class Alloc>174 void swap(unordered_set<Value, Hash, Pred, Alloc>& x,175 unordered_set<Value, Hash, Pred, Alloc>& y)176 noexcept(noexcept(x.swap(y)));177 178template <class Value, class Hash, class Pred, class Alloc>179 bool180 operator==(const unordered_set<Value, Hash, Pred, Alloc>& x,181 const unordered_set<Value, Hash, Pred, Alloc>& y);182 183template <class Value, class Hash, class Pred, class Alloc>184 bool185 operator!=(const unordered_set<Value, Hash, Pred, Alloc>& x,186 const unordered_set<Value, Hash, Pred, Alloc>& y);187 188template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,189 class Alloc = allocator<Value>>190class unordered_multiset191{192public:193 // types194 typedef Value key_type;195 typedef key_type value_type;196 typedef Hash hasher;197 typedef Pred key_equal;198 typedef Alloc allocator_type;199 typedef value_type& reference;200 typedef const value_type& const_reference;201 typedef typename allocator_traits<allocator_type>::pointer pointer;202 typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;203 typedef typename allocator_traits<allocator_type>::size_type size_type;204 typedef typename allocator_traits<allocator_type>::difference_type difference_type;205 206 typedef /unspecified/ iterator;207 typedef /unspecified/ const_iterator;208 typedef /unspecified/ local_iterator;209 typedef /unspecified/ const_local_iterator;210 211 typedef unspecified node_type unspecified; // C++17212 213 unordered_multiset()214 noexcept(215 is_nothrow_default_constructible<hasher>::value &&216 is_nothrow_default_constructible<key_equal>::value &&217 is_nothrow_default_constructible<allocator_type>::value);218 explicit unordered_multiset(size_type n, const hasher& hf = hasher(),219 const key_equal& eql = key_equal(),220 const allocator_type& a = allocator_type());221 template <class InputIterator>222 unordered_multiset(InputIterator f, InputIterator l,223 size_type n = 0, const hasher& hf = hasher(),224 const key_equal& eql = key_equal(),225 const allocator_type& a = allocator_type());226 explicit unordered_multiset(const allocator_type&);227 unordered_multiset(const unordered_multiset&);228 unordered_multiset(const unordered_multiset&, const Allocator&);229 unordered_multiset(unordered_multiset&&)230 noexcept(231 is_nothrow_move_constructible<hasher>::value &&232 is_nothrow_move_constructible<key_equal>::value &&233 is_nothrow_move_constructible<allocator_type>::value);234 unordered_multiset(unordered_multiset&&, const Allocator&);235 unordered_multiset(initializer_list<value_type>, size_type n = /see below/,236 const hasher& hf = hasher(), const key_equal& eql = key_equal(),237 const allocator_type& a = allocator_type());238 unordered_multiset(size_type n, const allocator_type& a); // C++14239 unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14240 template <class InputIterator>241 unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14242 template <class InputIterator>243 unordered_multiset(InputIterator f, InputIterator l, size_type n,244 const hasher& hf, const allocator_type& a); // C++14245 unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14246 unordered_multiset(initializer_list<value_type> il, size_type n,247 const hasher& hf, const allocator_type& a); // C++14248 ~unordered_multiset();249 unordered_multiset& operator=(const unordered_multiset&);250 unordered_multiset& operator=(unordered_multiset&&)251 noexcept(252 allocator_type::propagate_on_container_move_assignment::value &&253 is_nothrow_move_assignable<allocator_type>::value &&254 is_nothrow_move_assignable<hasher>::value &&255 is_nothrow_move_assignable<key_equal>::value);256 unordered_multiset& operator=(initializer_list<value_type>);257 258 allocator_type get_allocator() const noexcept;259 260 bool empty() const noexcept;261 size_type size() const noexcept;262 size_type max_size() const noexcept;263 264 iterator begin() noexcept;265 iterator end() noexcept;266 const_iterator begin() const noexcept;267 const_iterator end() const noexcept;268 const_iterator cbegin() const noexcept;269 const_iterator cend() const noexcept;270 271 template <class... Args>272 iterator emplace(Args&&... args);273 template <class... Args>274 iterator emplace_hint(const_iterator position, Args&&... args);275 iterator insert(const value_type& obj);276 iterator insert(value_type&& obj);277 iterator insert(const_iterator hint, const value_type& obj);278 iterator insert(const_iterator hint, value_type&& obj);279 template <class InputIterator>280 void insert(InputIterator first, InputIterator last);281 void insert(initializer_list<value_type>);282 283 node_type extract(const_iterator position); // C++17284 node_type extract(const key_type& x); // C++17285 iterator insert(node_type&& nh); // C++17286 iterator insert(const_iterator hint, node_type&& nh); // C++17287 288 iterator erase(const_iterator position);289 iterator erase(iterator position); // C++14290 size_type erase(const key_type& k);291 iterator erase(const_iterator first, const_iterator last);292 void clear() noexcept;293 294 template<class H2, class P2>295 void merge(unordered_multiset<Key, H2, P2, Allocator>& source); // C++17296 template<class H2, class P2>297 void merge(unordered_multiset<Key, H2, P2, Allocator>&& source); // C++17298 template<class H2, class P2>299 void merge(unordered_set<Key, H2, P2, Allocator>& source); // C++17300 template<class H2, class P2>301 void merge(unordered_set<Key, H2, P2, Allocator>&& source); // C++17302 303 void swap(unordered_multiset&)304 noexcept(allocator_traits<Allocator>::is_always_equal::value &&305 noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&306 noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17307 308 hasher hash_function() const;309 key_equal key_eq() const;310 311 iterator find(const key_type& k);312 const_iterator find(const key_type& k) const;313 size_type count(const key_type& k) const;314 bool contains(const key_type& k) const; // C++20315 pair<iterator, iterator> equal_range(const key_type& k);316 pair<const_iterator, const_iterator> equal_range(const key_type& k) const;317 318 size_type bucket_count() const noexcept;319 size_type max_bucket_count() const noexcept;320 321 size_type bucket_size(size_type n) const;322 size_type bucket(const key_type& k) const;323 324 local_iterator begin(size_type n);325 local_iterator end(size_type n);326 const_local_iterator begin(size_type n) const;327 const_local_iterator end(size_type n) const;328 const_local_iterator cbegin(size_type n) const;329 const_local_iterator cend(size_type n) const;330 331 float load_factor() const noexcept;332 float max_load_factor() const noexcept;333 void max_load_factor(float z);334 void rehash(size_type n);335 void reserve(size_type n);336};337 338template <class Value, class Hash, class Pred, class Alloc>339 void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x,340 unordered_multiset<Value, Hash, Pred, Alloc>& y)341 noexcept(noexcept(x.swap(y)));342 343template <class K, class T, class H, class P, class A, class Predicate>344 void erase_if(unordered_set<K, T, H, P, A>& c, Predicate pred); // C++20345 346template <class K, class T, class H, class P, class A, class Predicate>347 void erase_if(unordered_multiset<K, T, H, P, A>& c, Predicate pred); // C++20348 349 350template <class Value, class Hash, class Pred, class Alloc>351 bool352 operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x,353 const unordered_multiset<Value, Hash, Pred, Alloc>& y);354 355template <class Value, class Hash, class Pred, class Alloc>356 bool357 operator!=(const unordered_multiset<Value, Hash, Pred, Alloc>& x,358 const unordered_multiset<Value, Hash, Pred, Alloc>& y);359} // std360 361*/362 363#include <__config>364#include <__hash_table>365#include <__node_handle>366#include <functional>367#include <version>368 369#include <__debug>370 371#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)372# pragma GCC system_header373#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)374# pragma clang system_header375#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)376# pragma system_header377#endif // no system header378 379_LIBCUDACXX_BEGIN_NAMESPACE_STD380 381template <class _Value, class _Hash, class _Pred, class _Alloc>382class unordered_multiset;383 384template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,385 class _Alloc = allocator<_Value> >386class _LIBCUDACXX_TEMPLATE_VIS unordered_set387{388public:389 // types390 typedef _Value key_type;391 typedef key_type value_type;392 typedef __type_identity_t<_Hash> hasher;393 typedef __type_identity_t<_Pred> key_equal;394 typedef __type_identity_t<_Alloc> allocator_type;395 typedef value_type& reference;396 typedef const value_type& const_reference;397 static_assert((is_same<value_type, typename allocator_type::value_type>::value),398 "Invalid allocator::value_type");399 400private:401 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;402 403 __table __table_;404 405public:406 typedef typename __table::pointer pointer;407 typedef typename __table::const_pointer const_pointer;408 typedef typename __table::size_type size_type;409 typedef typename __table::difference_type difference_type;410 411 typedef typename __table::const_iterator iterator;412 typedef typename __table::const_iterator const_iterator;413 typedef typename __table::const_local_iterator local_iterator;414 typedef typename __table::const_local_iterator const_local_iterator;415 416#if _LIBCUDACXX_STD_VER > 14417 typedef __set_node_handle<typename __table::__node, allocator_type> node_type;418 typedef __insert_return_type<iterator, node_type> insert_return_type;419#endif420 421 template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>422 friend class _LIBCUDACXX_TEMPLATE_VIS unordered_set;423 template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>424 friend class _LIBCUDACXX_TEMPLATE_VIS unordered_multiset;425 426 _LIBCUDACXX_INLINE_VISIBILITY427 unordered_set()428 noexcept(is_nothrow_default_constructible<__table>::value)429 {430#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE431 __get_db()->__insert_c(this);432#endif433 }434 explicit unordered_set(size_type __n, const hasher& __hf = hasher(),435 const key_equal& __eql = key_equal());436#if _LIBCUDACXX_STD_VER > 11437 inline _LIBCUDACXX_INLINE_VISIBILITY438 unordered_set(size_type __n, const allocator_type& __a)439 : unordered_set(__n, hasher(), key_equal(), __a) {}440 inline _LIBCUDACXX_INLINE_VISIBILITY441 unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a)442 : unordered_set(__n, __hf, key_equal(), __a) {}443#endif444 unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql,445 const allocator_type& __a);446 template <class _InputIterator>447 unordered_set(_InputIterator __first, _InputIterator __last);448 template <class _InputIterator>449 unordered_set(_InputIterator __first, _InputIterator __last,450 size_type __n, const hasher& __hf = hasher(),451 const key_equal& __eql = key_equal());452 template <class _InputIterator>453 unordered_set(_InputIterator __first, _InputIterator __last,454 size_type __n, const hasher& __hf, const key_equal& __eql,455 const allocator_type& __a);456#if _LIBCUDACXX_STD_VER > 11457 template <class _InputIterator>458 inline _LIBCUDACXX_INLINE_VISIBILITY459 unordered_set(_InputIterator __first, _InputIterator __last,460 size_type __n, const allocator_type& __a)461 : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}462 template <class _InputIterator>463 unordered_set(_InputIterator __first, _InputIterator __last,464 size_type __n, const hasher& __hf, const allocator_type& __a)465 : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}466#endif467 _LIBCUDACXX_INLINE_VISIBILITY468 explicit unordered_set(const allocator_type& __a);469 unordered_set(const unordered_set& __u);470 unordered_set(const unordered_set& __u, const allocator_type& __a);471 _LIBCUDACXX_INLINE_VISIBILITY472 unordered_set(unordered_set&& __u)473 noexcept(is_nothrow_move_constructible<__table>::value);474 unordered_set(unordered_set&& __u, const allocator_type& __a);475 unordered_set(initializer_list<value_type> __il);476 unordered_set(initializer_list<value_type> __il, size_type __n,477 const hasher& __hf = hasher(),478 const key_equal& __eql = key_equal());479 unordered_set(initializer_list<value_type> __il, size_type __n,480 const hasher& __hf, const key_equal& __eql,481 const allocator_type& __a);482#if _LIBCUDACXX_STD_VER > 11483 inline _LIBCUDACXX_INLINE_VISIBILITY484 unordered_set(initializer_list<value_type> __il, size_type __n,485 const allocator_type& __a)486 : unordered_set(__il, __n, hasher(), key_equal(), __a) {}487 inline _LIBCUDACXX_INLINE_VISIBILITY488 unordered_set(initializer_list<value_type> __il, size_type __n,489 const hasher& __hf, const allocator_type& __a)490 : unordered_set(__il, __n, __hf, key_equal(), __a) {}491#endif492 _LIBCUDACXX_INLINE_VISIBILITY493 ~unordered_set() {494 static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");495 }496 497 _LIBCUDACXX_INLINE_VISIBILITY498 unordered_set& operator=(const unordered_set& __u)499 {500 __table_ = __u.__table_;501 return *this;502 }503 _LIBCUDACXX_INLINE_VISIBILITY504 unordered_set& operator=(unordered_set&& __u)505 noexcept(is_nothrow_move_assignable<__table>::value);506 _LIBCUDACXX_INLINE_VISIBILITY507 unordered_set& operator=(initializer_list<value_type> __il);508 509 _LIBCUDACXX_INLINE_VISIBILITY510 allocator_type get_allocator() const noexcept511 {return allocator_type(__table_.__node_alloc());}512 513 _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY514 bool empty() const noexcept {return __table_.size() == 0;}515 _LIBCUDACXX_INLINE_VISIBILITY516 size_type size() const noexcept {return __table_.size();}517 _LIBCUDACXX_INLINE_VISIBILITY518 size_type max_size() const noexcept {return __table_.max_size();}519 520 _LIBCUDACXX_INLINE_VISIBILITY521 iterator begin() noexcept {return __table_.begin();}522 _LIBCUDACXX_INLINE_VISIBILITY523 iterator end() noexcept {return __table_.end();}524 _LIBCUDACXX_INLINE_VISIBILITY525 const_iterator begin() const noexcept {return __table_.begin();}526 _LIBCUDACXX_INLINE_VISIBILITY527 const_iterator end() const noexcept {return __table_.end();}528 _LIBCUDACXX_INLINE_VISIBILITY529 const_iterator cbegin() const noexcept {return __table_.begin();}530 _LIBCUDACXX_INLINE_VISIBILITY531 const_iterator cend() const noexcept {return __table_.end();}532 533 template <class... _Args>534 _LIBCUDACXX_INLINE_VISIBILITY535 pair<iterator, bool> emplace(_Args&&... __args)536 {return __table_.__emplace_unique(_CUDA_VSTD::forward<_Args>(__args)...);}537 template <class... _Args>538 _LIBCUDACXX_INLINE_VISIBILITY539#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE540 iterator emplace_hint(const_iterator __p, _Args&&... __args)541 {542 _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,543 "unordered_set::emplace_hint(const_iterator, args...) called with an iterator not"544 " referring to this unordered_set");545 return __table_.__emplace_unique(_CUDA_VSTD::forward<_Args>(__args)...).first;546 }547#else548 iterator emplace_hint(const_iterator, _Args&&... __args)549 {return __table_.__emplace_unique(_CUDA_VSTD::forward<_Args>(__args)...).first;}550#endif551 552 _LIBCUDACXX_INLINE_VISIBILITY553 pair<iterator, bool> insert(value_type&& __x)554 {return __table_.__insert_unique(_CUDA_VSTD::move(__x));}555 _LIBCUDACXX_INLINE_VISIBILITY556#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE557 iterator insert(const_iterator __p, value_type&& __x)558 {559 _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,560 "unordered_set::insert(const_iterator, value_type&&) called with an iterator not"561 " referring to this unordered_set");562 return insert(_CUDA_VSTD::move(__x)).first;563 }564#else565 iterator insert(const_iterator, value_type&& __x)566 {return insert(_CUDA_VSTD::move(__x)).first;}567#endif568 _LIBCUDACXX_INLINE_VISIBILITY569 void insert(initializer_list<value_type> __il)570 {insert(__il.begin(), __il.end());}571 _LIBCUDACXX_INLINE_VISIBILITY572 pair<iterator, bool> insert(const value_type& __x)573 {return __table_.__insert_unique(__x);}574 575 _LIBCUDACXX_INLINE_VISIBILITY576#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE577 iterator insert(const_iterator __p, const value_type& __x)578 {579 _LIBCUDACXX_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,580 "unordered_set::insert(const_iterator, const value_type&) called with an iterator not"581 " referring to this unordered_set");582 return insert(__x).first;583 }584#else585 iterator insert(const_iterator, const value_type& __x)586 {return insert(__x).first;}587#endif588 template <class _InputIterator>589 _LIBCUDACXX_INLINE_VISIBILITY590 void insert(_InputIterator __first, _InputIterator __last);591 592 _LIBCUDACXX_INLINE_VISIBILITY593 iterator erase(const_iterator __p) {return __table_.erase(__p);}594 _LIBCUDACXX_INLINE_VISIBILITY595 size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}596 _LIBCUDACXX_INLINE_VISIBILITY597 iterator erase(const_iterator __first, const_iterator __last)598 {return __table_.erase(__first, __last);}599 _LIBCUDACXX_INLINE_VISIBILITY600 void clear() noexcept {__table_.clear();}601 602#if _LIBCUDACXX_STD_VER > 14603 _LIBCUDACXX_INLINE_VISIBILITY604 insert_return_type insert(node_type&& __nh)605 {606 _LIBCUDACXX_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),607 "node_type with incompatible allocator passed to unordered_set::insert()");608 return __table_.template __node_handle_insert_unique<609 node_type, insert_return_type>(_CUDA_VSTD::move(__nh));610 }611 _LIBCUDACXX_INLINE_VISIBILITY612 iterator insert(const_iterator __h, node_type&& __nh)613 {614 _LIBCUDACXX_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(),615 "node_type with incompatible allocator passed to unordered_set::insert()");616 return __table_.template __node_handle_insert_unique<node_type>(617 __h, _CUDA_VSTD::move(__nh));618 }619 _LIBCUDACXX_INLINE_VISIBILITY620 node_type extract(key_type const& __key)621 {622 return __table_.template __node_handle_extract<node_type>(__key);623 }624 _LIBCUDACXX_INLINE_VISIBILITY625 node_type extract(const_iterator __it)626 {627 return __table_.template __node_handle_extract<node_type>(__it);628 }629 630 template<class _H2, class _P2>631 _LIBCUDACXX_INLINE_VISIBILITY632 void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __source)633 {634 _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(),635 "merging container with incompatible allocator");636 __table_.__node_handle_merge_unique(__source.__table_);637 }638 template<class _H2, class _P2>639 _LIBCUDACXX_INLINE_VISIBILITY640 void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __source)641 {642 _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(),643 "merging container with incompatible allocator");644 __table_.__node_handle_merge_unique(__source.__table_);645 }646 template<class _H2, class _P2>647 _LIBCUDACXX_INLINE_VISIBILITY648 void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __source)649 {650 _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(),651 "merging container with incompatible allocator");652 __table_.__node_handle_merge_unique(__source.__table_);653 }654 template<class _H2, class _P2>655 _LIBCUDACXX_INLINE_VISIBILITY656 void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __source)657 {658 _LIBCUDACXX_ASSERT(__source.get_allocator() == get_allocator(),659 "merging container with incompatible allocator");660 __table_.__node_handle_merge_unique(__source.__table_);661 }662#endif663 664 _LIBCUDACXX_INLINE_VISIBILITY665 void swap(unordered_set& __u)666 noexcept(__is_nothrow_swappable<__table>::value)667 {__table_.swap(__u.__table_);}668 669 _LIBCUDACXX_INLINE_VISIBILITY670 hasher hash_function() const {return __table_.hash_function();}671 _LIBCUDACXX_INLINE_VISIBILITY672 key_equal key_eq() const {return __table_.key_eq();}673 674 _LIBCUDACXX_INLINE_VISIBILITY675 iterator find(const key_type& __k) {return __table_.find(__k);}676 _LIBCUDACXX_INLINE_VISIBILITY677 const_iterator find(const key_type& __k) const {return __table_.find(__k);}678 _LIBCUDACXX_INLINE_VISIBILITY679 size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}680 #if _LIBCUDACXX_STD_VER > 17681 _LIBCUDACXX_INLINE_VISIBILITY682 bool contains(const key_type& __k) const {return find(__k) != end();}683 #endif // _LIBCUDACXX_STD_VER > 17684 _LIBCUDACXX_INLINE_VISIBILITY685 pair<iterator, iterator> equal_range(const key_type& __k)686 {return __table_.__equal_range_unique(__k);}687 _LIBCUDACXX_INLINE_VISIBILITY688 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const689 {return __table_.__equal_range_unique(__k);}690 691 _LIBCUDACXX_INLINE_VISIBILITY692 size_type bucket_count() const noexcept {return __table_.bucket_count();}693 _LIBCUDACXX_INLINE_VISIBILITY694 size_type max_bucket_count() const noexcept {return __table_.max_bucket_count();}695 696 _LIBCUDACXX_INLINE_VISIBILITY697 size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}698 _LIBCUDACXX_INLINE_VISIBILITY699 size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}700 701 _LIBCUDACXX_INLINE_VISIBILITY702 local_iterator begin(size_type __n) {return __table_.begin(__n);}703 _LIBCUDACXX_INLINE_VISIBILITY704 local_iterator end(size_type __n) {return __table_.end(__n);}705 _LIBCUDACXX_INLINE_VISIBILITY706 const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}707 _LIBCUDACXX_INLINE_VISIBILITY708 const_local_iterator end(size_type __n) const {return __table_.cend(__n);}709 _LIBCUDACXX_INLINE_VISIBILITY710 const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}711 _LIBCUDACXX_INLINE_VISIBILITY712 const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}713 714 _LIBCUDACXX_INLINE_VISIBILITY715 float load_factor() const noexcept {return __table_.load_factor();}716 _LIBCUDACXX_INLINE_VISIBILITY717 float max_load_factor() const noexcept {return __table_.max_load_factor();}718 _LIBCUDACXX_INLINE_VISIBILITY719 void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}720 _LIBCUDACXX_INLINE_VISIBILITY721 void rehash(size_type __n) {__table_.rehash(__n);}722 _LIBCUDACXX_INLINE_VISIBILITY723 void reserve(size_type __n) {__table_.reserve(__n);}724 725#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE726 727 bool __dereferenceable(const const_iterator* __i) const728 {return __table_.__dereferenceable(__i);}729 bool __decrementable(const const_iterator* __i) const730 {return __table_.__decrementable(__i);}731 bool __addable(const const_iterator* __i, ptrdiff_t __n) const732 {return __table_.__addable(__i, __n);}733 bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const734 {return __table_.__addable(__i, __n);}735 736#endif // _LIBCUDACXX_ENABLE_DEBUG_MODE737 738};739 740#ifndef _LIBCUDACXX_HAS_NO_DEDUCTION_GUIDES741template<class _InputIterator,742 class _Hash = hash<__iter_value_type<_InputIterator>>,743 class _Pred = equal_to<__iter_value_type<_InputIterator>>,744 class _Allocator = allocator<__iter_value_type<_InputIterator>>,745 class = _EnableIf<!__is_allocator<_Hash>::value>,746 class = _EnableIf<!is_integral<_Hash>::value>,747 class = _EnableIf<!__is_allocator<_Pred>::value>,748 class = _EnableIf<__is_allocator<_Allocator>::value>>749unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,750 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())751 -> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;752 753template<class _Tp, class _Hash = hash<_Tp>,754 class _Pred = equal_to<_Tp>,755 class _Allocator = allocator<_Tp>,756 class = _EnableIf<!__is_allocator<_Hash>::value>,757 class = _EnableIf<!is_integral<_Hash>::value>,758 class = _EnableIf<!__is_allocator<_Pred>::value>,759 class = _EnableIf<__is_allocator<_Allocator>::value>>760unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,761 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())762 -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;763 764template<class _InputIterator, class _Allocator,765 class = _EnableIf<__is_allocator<_Allocator>::value>>766unordered_set(_InputIterator, _InputIterator,767 typename allocator_traits<_Allocator>::size_type, _Allocator)768 -> unordered_set<__iter_value_type<_InputIterator>,769 hash<__iter_value_type<_InputIterator>>,770 equal_to<__iter_value_type<_InputIterator>>,771 _Allocator>;772 773template<class _InputIterator, class _Hash, class _Allocator,774 class = _EnableIf<!__is_allocator<_Hash>::value>,775 class = _EnableIf<!is_integral<_Hash>::value>,776 class = _EnableIf<__is_allocator<_Allocator>::value>>777unordered_set(_InputIterator, _InputIterator,778 typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)779 -> unordered_set<__iter_value_type<_InputIterator>, _Hash,780 equal_to<__iter_value_type<_InputIterator>>,781 _Allocator>;782 783template<class _Tp, class _Allocator,784 class = _EnableIf<__is_allocator<_Allocator>::value>>785unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)786 -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;787 788template<class _Tp, class _Hash, class _Allocator,789 class = _EnableIf<!__is_allocator<_Hash>::value>,790 class = _EnableIf<!is_integral<_Hash>::value>,791 class = _EnableIf<__is_allocator<_Allocator>::value>>792unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)793 -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;794#endif795 796template <class _Value, class _Hash, class _Pred, class _Alloc>797unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,798 const hasher& __hf, const key_equal& __eql)799 : __table_(__hf, __eql)800{801#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE802 __get_db()->__insert_c(this);803#endif804 __table_.rehash(__n);805}806 807template <class _Value, class _Hash, class _Pred, class _Alloc>808unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,809 const hasher& __hf, const key_equal& __eql, const allocator_type& __a)810 : __table_(__hf, __eql, __a)811{812#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE813 __get_db()->__insert_c(this);814#endif815 __table_.rehash(__n);816}817 818template <class _Value, class _Hash, class _Pred, class _Alloc>819template <class _InputIterator>820unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(821 _InputIterator __first, _InputIterator __last)822{823#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE824 __get_db()->__insert_c(this);825#endif826 insert(__first, __last);827}828 829template <class _Value, class _Hash, class _Pred, class _Alloc>830template <class _InputIterator>831unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(832 _InputIterator __first, _InputIterator __last, size_type __n,833 const hasher& __hf, const key_equal& __eql)834 : __table_(__hf, __eql)835{836#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE837 __get_db()->__insert_c(this);838#endif839 __table_.rehash(__n);840 insert(__first, __last);841}842 843template <class _Value, class _Hash, class _Pred, class _Alloc>844template <class _InputIterator>845unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(846 _InputIterator __first, _InputIterator __last, size_type __n,847 const hasher& __hf, const key_equal& __eql, const allocator_type& __a)848 : __table_(__hf, __eql, __a)849{850#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE851 __get_db()->__insert_c(this);852#endif853 __table_.rehash(__n);854 insert(__first, __last);855}856 857template <class _Value, class _Hash, class _Pred, class _Alloc>858inline859unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(860 const allocator_type& __a)861 : __table_(__a)862{863#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE864 __get_db()->__insert_c(this);865#endif866}867 868template <class _Value, class _Hash, class _Pred, class _Alloc>869unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(870 const unordered_set& __u)871 : __table_(__u.__table_)872{873#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE874 __get_db()->__insert_c(this);875#endif876 __table_.rehash(__u.bucket_count());877 insert(__u.begin(), __u.end());878}879 880template <class _Value, class _Hash, class _Pred, class _Alloc>881unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(882 const unordered_set& __u, const allocator_type& __a)883 : __table_(__u.__table_, __a)884{885#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE886 __get_db()->__insert_c(this);887#endif888 __table_.rehash(__u.bucket_count());889 insert(__u.begin(), __u.end());890}891 892template <class _Value, class _Hash, class _Pred, class _Alloc>893inline894unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(895 unordered_set&& __u)896 noexcept(is_nothrow_move_constructible<__table>::value)897 : __table_(_CUDA_VSTD::move(__u.__table_))898{899#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE900 __get_db()->__insert_c(this);901 __get_db()->swap(this, &__u);902#endif903}904 905template <class _Value, class _Hash, class _Pred, class _Alloc>906unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(907 unordered_set&& __u, const allocator_type& __a)908 : __table_(_CUDA_VSTD::move(__u.__table_), __a)909{910#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE911 __get_db()->__insert_c(this);912#endif913 if (__a != __u.get_allocator())914 {915 iterator __i = __u.begin();916 while (__u.size() != 0)917 __table_.__insert_unique(_CUDA_VSTD::move(__u.__table_.remove(__i++)->__value_));918 }919#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE920 else921 __get_db()->swap(this, &__u);922#endif923}924 925template <class _Value, class _Hash, class _Pred, class _Alloc>926unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(927 initializer_list<value_type> __il)928{929#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE930 __get_db()->__insert_c(this);931#endif932 insert(__il.begin(), __il.end());933}934 935template <class _Value, class _Hash, class _Pred, class _Alloc>936unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(937 initializer_list<value_type> __il, size_type __n, const hasher& __hf,938 const key_equal& __eql)939 : __table_(__hf, __eql)940{941#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE942 __get_db()->__insert_c(this);943#endif944 __table_.rehash(__n);945 insert(__il.begin(), __il.end());946}947 948template <class _Value, class _Hash, class _Pred, class _Alloc>949unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(950 initializer_list<value_type> __il, size_type __n, const hasher& __hf,951 const key_equal& __eql, const allocator_type& __a)952 : __table_(__hf, __eql, __a)953{954#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE955 __get_db()->__insert_c(this);956#endif957 __table_.rehash(__n);958 insert(__il.begin(), __il.end());959}960 961template <class _Value, class _Hash, class _Pred, class _Alloc>962inline963unordered_set<_Value, _Hash, _Pred, _Alloc>&964unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)965 noexcept(is_nothrow_move_assignable<__table>::value)966{967 __table_ = _CUDA_VSTD::move(__u.__table_);968 return *this;969}970 971template <class _Value, class _Hash, class _Pred, class _Alloc>972inline973unordered_set<_Value, _Hash, _Pred, _Alloc>&974unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(975 initializer_list<value_type> __il)976{977 __table_.__assign_unique(__il.begin(), __il.end());978 return *this;979}980 981template <class _Value, class _Hash, class _Pred, class _Alloc>982template <class _InputIterator>983inline984void985unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,986 _InputIterator __last)987{988 for (; __first != __last; ++__first)989 __table_.__insert_unique(*__first);990}991 992template <class _Value, class _Hash, class _Pred, class _Alloc>993inline _LIBCUDACXX_INLINE_VISIBILITY994void995swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,996 unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)997 noexcept(noexcept(__x.swap(__y)))998{999 __x.swap(__y);1000}1001 1002#if _LIBCUDACXX_STD_VER > 171003template <class _Value, class _Hash, class _Pred, class _Alloc, class _Predicate>1004inline _LIBCUDACXX_INLINE_VISIBILITY1005void erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c, _Predicate __pred)1006{ __libcpp_erase_if_container(__c, __pred); }1007#endif1008 1009template <class _Value, class _Hash, class _Pred, class _Alloc>1010bool1011operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,1012 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)1013{1014 if (__x.size() != __y.size())1015 return false;1016 typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator1017 const_iterator;1018 for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end();1019 __i != __ex; ++__i)1020 {1021 const_iterator __j = __y.find(*__i);1022 if (__j == __ey || !(*__i == *__j))1023 return false;1024 }1025 return true;1026}1027 1028template <class _Value, class _Hash, class _Pred, class _Alloc>1029inline _LIBCUDACXX_INLINE_VISIBILITY1030bool1031operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,1032 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)1033{1034 return !(__x == __y);1035}1036 1037template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,1038 class _Alloc = allocator<_Value> >1039class _LIBCUDACXX_TEMPLATE_VIS unordered_multiset1040{1041public:1042 // types1043 typedef _Value key_type;1044 typedef key_type value_type;1045 typedef __type_identity_t<_Hash> hasher;1046 typedef __type_identity_t<_Pred> key_equal;1047 typedef __type_identity_t<_Alloc> allocator_type;1048 typedef value_type& reference;1049 typedef const value_type& const_reference;1050 static_assert((is_same<value_type, typename allocator_type::value_type>::value),1051 "Invalid allocator::value_type");1052 1053private:1054 typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;1055 1056 __table __table_;1057 1058public:1059 typedef typename __table::pointer pointer;1060 typedef typename __table::const_pointer const_pointer;1061 typedef typename __table::size_type size_type;1062 typedef typename __table::difference_type difference_type;1063 1064 typedef typename __table::const_iterator iterator;1065 typedef typename __table::const_iterator const_iterator;1066 typedef typename __table::const_local_iterator local_iterator;1067 typedef typename __table::const_local_iterator const_local_iterator;1068 1069#if _LIBCUDACXX_STD_VER > 141070 typedef __set_node_handle<typename __table::__node, allocator_type> node_type;1071#endif1072 1073 template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>1074 friend class _LIBCUDACXX_TEMPLATE_VIS unordered_set;1075 template <class _Value2, class _Hash2, class _Pred2, class _Alloc2>1076 friend class _LIBCUDACXX_TEMPLATE_VIS unordered_multiset;1077 1078 _LIBCUDACXX_INLINE_VISIBILITY1079 unordered_multiset()1080 noexcept(is_nothrow_default_constructible<__table>::value)1081 {1082#ifdef _LIBCUDACXX_ENABLE_DEBUG_MODE1083 __get_db()->__insert_c(this);1084#endif1085 }1086 explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(),1087 const key_equal& __eql = key_equal());1088 unordered_multiset(size_type __n, const hasher& __hf,1089 const key_equal& __eql, const allocator_type& __a);1090#if _LIBCUDACXX_STD_VER > 111091 inline _LIBCUDACXX_INLINE_VISIBILITY1092 unordered_multiset(size_type __n, const allocator_type& __a)1093 : unordered_multiset(__n, hasher(), key_equal(), __a) {}1094 inline _LIBCUDACXX_INLINE_VISIBILITY1095 unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a)1096 : unordered_multiset(__n, __hf, key_equal(), __a) {}1097#endif1098 template <class _InputIterator>1099 unordered_multiset(_InputIterator __first, _InputIterator __last);1100 template <class _InputIterator>1101 unordered_multiset(_InputIterator __first, _InputIterator __last,1102 size_type __n, const hasher& __hf = hasher(),1103 const key_equal& __eql = key_equal());1104 template <class _InputIterator>1105 unordered_multiset(_InputIterator __first, _InputIterator __last,1106 size_type __n , const hasher& __hf,1107 const key_equal& __eql, const allocator_type& __a);1108#if _LIBCUDACXX_STD_VER > 111109 template <class _InputIterator>1110 inline _LIBCUDACXX_INLINE_VISIBILITY1111 unordered_multiset(_InputIterator __first, _InputIterator __last,1112 size_type __n, const allocator_type& __a)1113 : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}1114 template <class _InputIterator>1115 inline _LIBCUDACXX_INLINE_VISIBILITY1116 unordered_multiset(_InputIterator __first, _InputIterator __last,1117 size_type __n, const hasher& __hf, const allocator_type& __a)1118 : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {}1119#endif1120 _LIBCUDACXX_INLINE_VISIBILITY1121 explicit unordered_multiset(const allocator_type& __a);1122 unordered_multiset(const unordered_multiset& __u);1123 unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);1124 _LIBCUDACXX_INLINE_VISIBILITY1125 unordered_multiset(unordered_multiset&& __u)1126 noexcept(is_nothrow_move_constructible<__table>::value);1127 unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);1128 unordered_multiset(initializer_list<value_type> __il);1129 unordered_multiset(initializer_list<value_type> __il, size_type __n,1130 const hasher& __hf = hasher(),1131 const key_equal& __eql = key_equal());1132 unordered_multiset(initializer_list<value_type> __il, size_type __n,1133 const hasher& __hf, const key_equal& __eql,1134 const allocator_type& __a);1135#if _LIBCUDACXX_STD_VER > 111136 inline _LIBCUDACXX_INLINE_VISIBILITY1137 unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)1138 : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {}1139 inline _LIBCUDACXX_INLINE_VISIBILITY1140 unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)1141 : unordered_multiset(__il, __n, __hf, key_equal(), __a) {}1142#endif1143 _LIBCUDACXX_INLINE_VISIBILITY1144 ~unordered_multiset() {1145 static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");1146 }1147 1148 _LIBCUDACXX_INLINE_VISIBILITY1149 unordered_multiset& operator=(const unordered_multiset& __u)1150 {1151 __table_ = __u.__table_;1152 return *this;1153 }1154 _LIBCUDACXX_INLINE_VISIBILITY1155 unordered_multiset& operator=(unordered_multiset&& __u)1156 noexcept(is_nothrow_move_assignable<__table>::value);1157 unordered_multiset& operator=(initializer_list<value_type> __il);1158 1159 _LIBCUDACXX_INLINE_VISIBILITY1160 allocator_type get_allocator() const noexcept1161 {return allocator_type(__table_.__node_alloc());}1162 1163 _LIBCUDACXX_NODISCARD_AFTER_CXX17 _LIBCUDACXX_INLINE_VISIBILITY1164 bool empty() const noexcept {return __table_.size() == 0;}1165 _LIBCUDACXX_INLINE_VISIBILITY1166 size_type size() const noexcept {return __table_.size();}1167 _LIBCUDACXX_INLINE_VISIBILITY1168 size_type max_size() const noexcept {return __table_.max_size();}1169 1170 _LIBCUDACXX_INLINE_VISIBILITY1171 iterator begin() noexcept {return __table_.begin();}1172 _LIBCUDACXX_INLINE_VISIBILITY1173 iterator end() noexcept {return __table_.end();}1174 _LIBCUDACXX_INLINE_VISIBILITY1175 const_iterator begin() const noexcept {return __table_.begin();}1176 _LIBCUDACXX_INLINE_VISIBILITY1177 const_iterator end() const noexcept {return __table_.end();}1178 _LIBCUDACXX_INLINE_VISIBILITY1179 const_iterator cbegin() const noexcept {return __table_.begin();}1180 _LIBCUDACXX_INLINE_VISIBILITY1181 const_iterator cend() const noexcept {return __table_.end();}1182 1183 template <class... _Args>1184 _LIBCUDACXX_INLINE_VISIBILITY1185 iterator emplace(_Args&&... __args)1186 {return __table_.__emplace_multi(_CUDA_VSTD::forward<_Args>(__args)...);}1187 template <class... _Args>1188 _LIBCUDACXX_INLINE_VISIBILITY1189 iterator emplace_hint(const_iterator __p, _Args&&... __args)1190 {return __table_.__emplace_hint_multi(__p, _CUDA_VSTD::forward<_Args>(__args)...);}1191 1192 _LIBCUDACXX_INLINE_VISIBILITY1193 iterator insert(value_type&& __x) {return __table_.__insert_multi(_CUDA_VSTD::move(__x));}1194 _LIBCUDACXX_INLINE_VISIBILITY1195 iterator insert(const_iterator __p, value_type&& __x)1196 {return __table_.__insert_multi(__p, _CUDA_VSTD::move(__x));}1197 _LIBCUDACXX_INLINE_VISIBILITY1198 void insert(initializer_list<value_type> __il)1199 {insert(__il.begin(), __il.end());}1200 