30 #ifndef _UNORDERED_SET_H
31 #define _UNORDERED_SET_H
33 namespace std _GLIBCXX_VISIBILITY(default)
35 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
41 template<
typename _Value,
47 __detail::_Identity, _Pred, _Hash,
56 template<
typename _Value,
89 template<
class _Value,
103 typedef typename _Hashtable::value_type value_type;
104 typedef typename _Hashtable::hasher hasher;
105 typedef typename _Hashtable::key_equal key_equal;
106 typedef typename _Hashtable::allocator_type allocator_type;
112 typedef typename _Hashtable::const_pointer const_pointer;
113 typedef typename _Hashtable::reference reference;
114 typedef typename _Hashtable::const_reference const_reference;
115 typedef typename _Hashtable::iterator iterator;
116 typedef typename _Hashtable::const_iterator const_iterator;
117 typedef typename _Hashtable::local_iterator local_iterator;
118 typedef typename _Hashtable::const_local_iterator const_local_iterator;
119 typedef typename _Hashtable::size_type size_type;
120 typedef typename _Hashtable::difference_type difference_type;
137 const hasher& __hf = hasher(),
138 const key_equal& __eql = key_equal(),
139 const allocator_type& __a = allocator_type())
140 : _M_h(__n, __hf, __eql, __a)
156 template<
typename _InputIterator>
159 const hasher& __hf = hasher(),
160 const key_equal& __eql = key_equal(),
161 const allocator_type& __a = allocator_type())
162 : _M_h(__first, __last, __n, __hf, __eql, __a)
186 const allocator_type& __a)
187 : _M_h(__uset._M_h, __a)
196 const allocator_type& __a)
197 : _M_h(
std::move(__uset._M_h), __a)
213 const hasher& __hf = hasher(),
214 const key_equal& __eql = key_equal(),
215 const allocator_type& __a = allocator_type())
216 : _M_h(__l, __n, __hf, __eql, __a)
224 const allocator_type& __a)
228 template<
typename _InputIterator>
231 const allocator_type& __a)
232 :
unordered_set(__first, __last, __n, hasher(), key_equal(), __a)
235 template<
typename _InputIterator>
237 size_type __n,
const hasher& __hf,
238 const allocator_type& __a)
239 :
unordered_set(__first, __last, __n, __hf, key_equal(), __a)
244 const allocator_type& __a)
249 size_type __n,
const hasher& __hf,
250 const allocator_type& __a)
284 {
return _M_h.get_allocator(); }
291 {
return _M_h.empty(); }
296 {
return _M_h.size(); }
301 {
return _M_h.max_size(); }
312 {
return _M_h.begin(); }
315 begin() const noexcept
316 {
return _M_h.begin(); }
326 {
return _M_h.end(); }
330 {
return _M_h.end(); }
339 {
return _M_h.begin(); }
347 {
return _M_h.end(); }
366 template<
typename... _Args>
369 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
392 template<
typename... _Args>
395 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
413 {
return _M_h.insert(__x); }
417 {
return _M_h.insert(std::move(__x)); }
441 insert(const_iterator __hint,
const value_type& __x)
442 {
return _M_h.insert(__hint, __x); }
445 insert(const_iterator __hint, value_type&& __x)
446 {
return _M_h.insert(__hint, std::move(__x)); }
458 template<
typename _InputIterator>
460 insert(_InputIterator __first, _InputIterator __last)
461 { _M_h.insert(__first, __last); }
472 { _M_h.insert(__l); }
490 {
return _M_h.erase(__position); }
495 {
return _M_h.erase(__position); }
512 {
return _M_h.erase(__x); }
529 erase(const_iterator __first, const_iterator __last)
530 {
return _M_h.erase(__first, __last); }
553 noexcept( noexcept(_M_h.swap(__x._M_h)) )
554 { _M_h.swap(__x._M_h); }
562 {
return _M_h.hash_function(); }
568 {
return _M_h.key_eq(); }
586 {
return _M_h.find(__x); }
590 {
return _M_h.find(__x); }
604 {
return _M_h.count(__x); }
617 {
return _M_h.equal_range(__x); }
621 {
return _M_h.equal_range(__x); }
629 {
return _M_h.bucket_count(); }
634 {
return _M_h.max_bucket_count(); }
642 bucket_size(size_type __n)
const
643 {
return _M_h.bucket_size(__n); }
652 {
return _M_h.bucket(__key); }
663 {
return _M_h.begin(__n); }
666 begin(size_type __n)
const
667 {
return _M_h.begin(__n); }
670 cbegin(size_type __n)
const
671 {
return _M_h.cbegin(__n); }
683 {
return _M_h.end(__n); }
686 end(size_type __n)
const
687 {
return _M_h.end(__n); }
690 cend(size_type __n)
const
691 {
return _M_h.cend(__n); }
699 {
return _M_h.load_factor(); }
705 {
return _M_h.max_load_factor(); }
713 { _M_h.max_load_factor(__z); }
724 { _M_h.rehash(__n); }
735 { _M_h.reserve(__n); }
737 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
763 template<
class _Value,
764 class _Hash = hash<_Value>,
777 typedef typename _Hashtable::value_type value_type;
778 typedef typename _Hashtable::hasher hasher;
779 typedef typename _Hashtable::key_equal key_equal;
780 typedef typename _Hashtable::allocator_type allocator_type;
786 typedef typename _Hashtable::const_pointer const_pointer;
787 typedef typename _Hashtable::reference reference;
788 typedef typename _Hashtable::const_reference const_reference;
789 typedef typename _Hashtable::iterator iterator;
790 typedef typename _Hashtable::const_iterator const_iterator;
791 typedef typename _Hashtable::local_iterator local_iterator;
792 typedef typename _Hashtable::const_local_iterator const_local_iterator;
793 typedef typename _Hashtable::size_type size_type;
794 typedef typename _Hashtable::difference_type difference_type;
811 const hasher& __hf = hasher(),
812 const key_equal& __eql = key_equal(),
813 const allocator_type& __a = allocator_type())
814 : _M_h(__n, __hf, __eql, __a)
830 template<
typename _InputIterator>
833 const hasher& __hf = hasher(),
834 const key_equal& __eql = key_equal(),
835 const allocator_type& __a = allocator_type())
836 : _M_h(__first, __last, __n, __hf, __eql, __a)
858 const hasher& __hf = hasher(),
859 const key_equal& __eql = key_equal(),
860 const allocator_type& __a = allocator_type())
861 : _M_h(__l, __n, __hf, __eql, __a)
887 const allocator_type& __a)
888 : _M_h(__umset._M_h, __a)
897 const allocator_type& __a)
898 : _M_h(
std::move(__umset._M_h), __a)
906 const allocator_type& __a)
910 template<
typename _InputIterator>
913 const allocator_type& __a)
917 template<
typename _InputIterator>
919 size_type __n,
const hasher& __hf,
920 const allocator_type& __a)
926 const allocator_type& __a)
931 size_type __n,
const hasher& __hf,
932 const allocator_type& __a)
958 {
return _M_h.get_allocator(); }
965 {
return _M_h.empty(); }
970 {
return _M_h.size(); }
975 {
return _M_h.max_size(); }
986 {
return _M_h.begin(); }
989 begin() const noexcept
990 {
return _M_h.begin(); }
1000 {
return _M_h.end(); }
1003 end() const noexcept
1004 {
return _M_h.end(); }
1013 {
return _M_h.begin(); }
1021 {
return _M_h.end(); }
1032 template<
typename... _Args>
1035 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
1054 template<
typename... _Args>
1057 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
1069 {
return _M_h.insert(__x); }
1073 {
return _M_h.insert(std::move(__x)); }
1094 insert(const_iterator __hint,
const value_type& __x)
1095 {
return _M_h.insert(__hint, __x); }
1098 insert(const_iterator __hint, value_type&& __x)
1099 {
return _M_h.insert(__hint, std::move(__x)); }
1110 template<
typename _InputIterator>
1112 insert(_InputIterator __first, _InputIterator __last)
1113 { _M_h.insert(__first, __last); }
1124 { _M_h.insert(__l); }
1143 {
return _M_h.erase(__position); }
1148 {
return _M_h.erase(__position); }
1166 {
return _M_h.erase(__x); }
1185 erase(const_iterator __first, const_iterator __last)
1186 {
return _M_h.erase(__first, __last); }
1210 noexcept( noexcept(_M_h.swap(__x._M_h)) )
1211 { _M_h.swap(__x._M_h); }
1219 {
return _M_h.hash_function(); }
1225 {
return _M_h.key_eq(); }
1243 {
return _M_h.find(__x); }
1247 {
return _M_h.find(__x); }
1257 {
return _M_h.count(__x); }
1268 {
return _M_h.equal_range(__x); }
1272 {
return _M_h.equal_range(__x); }
1280 {
return _M_h.bucket_count(); }
1285 {
return _M_h.max_bucket_count(); }
1293 bucket_size(size_type __n)
const
1294 {
return _M_h.bucket_size(__n); }
1302 bucket(
const key_type& __key)
const
1303 {
return _M_h.bucket(__key); }
1314 {
return _M_h.begin(__n); }
1316 const_local_iterator
1317 begin(size_type __n)
const
1318 {
return _M_h.begin(__n); }
1320 const_local_iterator
1321 cbegin(size_type __n)
const
1322 {
return _M_h.cbegin(__n); }
1334 {
return _M_h.end(__n); }
1336 const_local_iterator
1337 end(size_type __n)
const
1338 {
return _M_h.end(__n); }
1340 const_local_iterator
1341 cend(size_type __n)
const
1342 {
return _M_h.cend(__n); }
1350 {
return _M_h.load_factor(); }
1356 {
return _M_h.max_load_factor(); }
1364 { _M_h.max_load_factor(__z); }
1375 { _M_h.rehash(__n); }
1386 { _M_h.reserve(__n); }
1388 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
1395 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1397 swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
1398 unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
1399 noexcept(noexcept(__x.swap(__y)))
1402 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1404 swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1405 unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1406 noexcept(noexcept(__x.swap(__y)))
1409 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1411 operator==(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
1412 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
1413 {
return __x._M_h._M_equal(__y._M_h); }
1415 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1417 operator!=(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
1418 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
1419 {
return !(__x == __y); }
1421 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1423 operator==(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1424 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1425 {
return __x._M_h._M_equal(__y._M_h); }
1427 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1429 operator!=(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1430 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1431 {
return !(__x == __y); }
1433 _GLIBCXX_END_NAMESPACE_CONTAINER