11#ifndef INCLUDED_BSLSTL_UNORDEREDSET_CPP03
12#define INCLUDED_BSLSTL_UNORDEREDSET_CPP03
63#ifdef COMPILING_BSLSTL_UNORDEREDSET_H
99 typedef KEY ValueType;
104 typedef ::BloombergLP::bslstl::UnorderedSetKeyConfiguration<ValueType>
109 typedef ::BloombergLP::bslstl::HashTable<ListConfiguration,
112 ALLOCATOR> HashTable;
116 typedef ::BloombergLP::bslalg::BidirectionalLink HashTableLink;
120 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
123 template <
class KEY2,
128 const unordered_set<KEY2, HASH2, EQUAL2, ALLOCATOR2>&,
129 const unordered_set<KEY2, HASH2, EQUAL2, ALLOCATOR2>&);
145 typedef ::BloombergLP::bslstl::HashTableIterator<
147 typedef ::BloombergLP::bslstl::HashTableBucketIterator<
158 ::BloombergLP::bslmf::IsBitwiseMoveable,
159 ::BloombergLP::bslmf::IsBitwiseMoveable<HashTable>::value);
170 const HASH& hashFunction = HASH(),
171 const EQUAL& keyEqual = EQUAL(),
172 const ALLOCATOR& basicAllocator = ALLOCATOR());
174 const HASH& hashFunction,
175 const ALLOCATOR& basicAllocator);
177 const ALLOCATOR& basicAllocator);
217 unordered_set(BloombergLP::bslmf::MovableRef<unordered_set> original);
247 BloombergLP::bslmf::MovableRef<unordered_set> original,
279 template <
class INPUT_ITERATOR>
283 const HASH& hashFunction = HASH(),
284 const EQUAL& keyEqual = EQUAL(),
285 const ALLOCATOR& basicAllocator = ALLOCATOR());
286 template <
class INPUT_ITERATOR>
290 const HASH& hashFunction,
291 const ALLOCATOR& basicAllocator);
292 template <
class INPUT_ITERATOR>
296 const ALLOCATOR& basicAllocator);
297 template <
class INPUT_ITERATOR>
300 const ALLOCATOR& basicAllocator);
302#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
303# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
305 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
306 class = bsl::enable_if_t<
307 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
308 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
312 size_type initialNumBuckets = 0,
313 const HASH& hashFunction = HASH(),
314 const EQUAL& keyEqual = EQUAL(),
315 const ALLOCATOR& basicAllocator = ALLOCATOR());
316# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
318 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
319 class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>
323 size_type initialNumBuckets,
324 const HASH& hashFunction,
325 const ALLOCATOR& basicAllocator);
326# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
327 template <class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>>
330 size_type initialNumBuckets,
331 const ALLOCATOR& basicAllocator);
332# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
355 template <class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>>
358 const ALLOCATOR& basicAllocator);
392 operator=(BloombergLP::bslmf::MovableRef<unordered_set> rhs)
394 AllocatorTraits::is_always_equal::value
395 && std::is_nothrow_move_assignable<HASH>::value
396 && std::is_nothrow_move_assignable<EQUAL>::value);
398#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
440 pair<iterator, bool>
insert(const value_type& value);
452 pair<iterator, bool>
insert(
453 BloombergLP::bslmf::MovableRef<value_type> value);
483 BloombergLP::bslmf::MovableRef<value_type> value);
497 template <class INPUT_ITERATOR>
498 void
insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
500#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
506 void
insert(std::initializer_list<KEY> values);
509#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
512#ifndef BSLSTL_UNORDEREDSET_VARIADIC_LIMIT
513#define BSLSTL_UNORDEREDSET_VARIADIC_LIMIT 10
515#ifndef BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A
516#define BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A BSLSTL_UNORDEREDSET_VARIADIC_LIMIT
518#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 0
523#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 1
524 template <class Args_01>
526 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01);
529#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 2
530 template <class Args_01,
533 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
534 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02);
537#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 3
538 template <class Args_01,
542 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
543 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
544 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03);
547#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 4
548 template <class Args_01,
553 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
554 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
555 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
556 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04);
559#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 5
560 template <class Args_01,
566 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
567 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
568 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
569 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
570 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05);
573#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 6
574 template <class Args_01,
581 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
582 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
583 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
584 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
585 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
586 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06);
589#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 7
590 template <class Args_01,
598 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
599 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
600 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
601 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
602 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
603 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
604 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07);
607#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 8
608 template <class Args_01,
617 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
618 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
619 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
620 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
621 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
622 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
623 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
624 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08);
627#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 9
628 template <class Args_01,
638 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
639 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
640 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
641 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
642 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
643 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
644 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
645 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
646 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09);
649#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 10
650 template <class Args_01,
661 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
662 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
663 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
664 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
665 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
666 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
667 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
668 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
669 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
670 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10);
674#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 0
678#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 1
679 template <class Args_01>
681 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01);
684#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 2
685 template <class Args_01,
688 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
689 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02);
692#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 3
693 template <class Args_01,
697 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
698 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
699 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03);
702#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 4
703 template <class Args_01,
708 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
709 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
710 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
711 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04);
714#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 5
715 template <class Args_01,
721 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
722 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
723 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
724 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
725 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05);
728#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 6
729 template <class Args_01,
736 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
737 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
738 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
739 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
740 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
741 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06);
744#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 7
745 template <class Args_01,
753 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
754 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
755 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
756 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
757 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
758 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
759 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07);
762#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 8
763 template <class Args_01,
772 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
773 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
774 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
775 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
776 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
777 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
778 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
779 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08);
782#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 9
783 template <class Args_01,
793 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
794 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
795 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
796 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
797 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
798 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
799 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
800 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
801 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09);
804#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_A >= 10
805 template <class Args_01,
816 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
817 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
818 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
819 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
820 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
821 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
822 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
823 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
824 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
825 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10);
831 template <class... Args>
833 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... arguments);
835 template <class... Args>
837 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... arguments);
888 AllocatorTraits::is_always_equal::value
889 && bsl::is_nothrow_swappable<HASH>::value
890 && bsl::is_nothrow_swappable<EQUAL>::value);
902 template <class LOOKUP_KEY>
904 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
905 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
907 find(const LOOKUP_KEY& key)
910 return iterator(d_impl.find(key));
929 template <
class LOOKUP_KEY>
931 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
932 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
933 pair<iterator, iterator> >::type
939 HashTableLink *first = d_impl.find(key);
1010 template <class LOOKUP_KEY>
1012 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value &&
1013 BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,
1016 contains(const LOOKUP_KEY& key)
const
1049 template <class LOOKUP_KEY>
1051 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1052 && BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1054 find(const LOOKUP_KEY& key)
const
1071 template <
class LOOKUP_KEY>
1073 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1074 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1076 count(
const LOOKUP_KEY& key)
const
1079 return d_impl.find(key) != 0;
1098 template <
class LOOKUP_KEY>
1100 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1101 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1102 pair<const_iterator, const_iterator> >::type
1108 HashTableLink *first = d_impl.find(key);
1184#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1195 class INPUT_ITERATOR,
1196 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1200 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY&>>,
1201 class = bsl::enable_if_t<
1202 std::is_invocable_v<EQUAL, const KEY&, const KEY&>>,
1203 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1207 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1210 ALLOCATOR = ALLOCATOR())
1219 class INPUT_ITERATOR,
1220 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1224 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1225 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1229 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1242 class INPUT_ITERATOR,
1243 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1246 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1247 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1251 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1262 class INPUT_ITERATOR,
1263 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1266 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1267 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1271 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1281 class INPUT_ITERATOR,
1283 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1284 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1288 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1290->
unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1297 class INPUT_ITERATOR,
1298 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1300 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1301 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1305 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1314 class INPUT_ITERATOR,
1316 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1317 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1320->
unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1327 class INPUT_ITERATOR,
1328 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1330 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1331 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1345 class HASH = bsl::hash<KEY>,
1346 class EQUAL = bsl::equal_to<KEY>,
1347 class ALLOCATOR = bsl::allocator<KEY>,
1348 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY&>>,
1349 class = bsl::enable_if_t<
1350 std::is_invocable_v<EQUAL, const KEY&, const KEY&>>,
1351 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1354 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1357 ALLOCATOR = ALLOCATOR())
1370 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1371 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1374 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1390 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1391 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1394 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1409 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1410 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1413 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1425 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1428 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1430->
unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1439 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1440 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1443 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1454 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1457->
unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1466 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1467 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1482template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1483bool operator==(const unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& lhs,
1484 const unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& rhs);
1486#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
1487template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1488bool operator!=(const unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& lhs,
1489 const unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& rhs);
1504template <class KEY, class HASH, class EQUAL, class ALLOCATOR, class PREDICATE>
1506erase_if(unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& s, PREDICATE predicate);
1508template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1509void
swap(unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& a,
1510 unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& b)
1512 BSLS_KEYWORD_NOEXCEPT_OPERATOR(a.swap(b)));
1535template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1538: d_impl(HASH(), EQUAL(), 0, 1.0f, ALLOCATOR())
1542template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1546 const HASH& hashFunction,
1547 const EQUAL& keyEqual,
1548 const ALLOCATOR& basicAllocator)
1549: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1553template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1555unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1556 size_type initialNumBuckets,
1557 const HASH& hashFunction,
1558 const ALLOCATOR& basicAllocator)
1559: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1563template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1565unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1566 size_type initialNumBuckets,
1567 const ALLOCATOR& basicAllocator)
1568: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1572template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1574unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1575 const ALLOCATOR& basicAllocator)
1576: d_impl(basicAllocator)
1580template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1582unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1583 const unordered_set& original)
1584: d_impl(original.d_impl,
1585 AllocatorTraits::select_on_container_copy_construction(
1586 original.get_allocator()))
1590template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1592unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1593 BloombergLP::bslmf::MovableRef<unordered_set> original)
1594: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl))
1598template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1600unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1601 const unordered_set& original,
1602 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1603: d_impl(original.d_impl, basicAllocator)
1607template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1609unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1610 BloombergLP::bslmf::MovableRef<unordered_set> original,
1611 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1612: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl), basicAllocator)
1616template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1617template <
class INPUT_ITERATOR>
1619unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1620 INPUT_ITERATOR first,
1621 INPUT_ITERATOR last,
1622 size_type initialNumBuckets,
1623 const HASH& hashFunction,
1624 const EQUAL& keyEqual,
1625 const ALLOCATOR& basicAllocator)
1626: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1628 this->insert(first, last);
1631template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1632template <
class INPUT_ITERATOR>
1634unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1635 INPUT_ITERATOR first,
1636 INPUT_ITERATOR last,
1637 size_type initialNumBuckets,
1638 const HASH& hashFunction,
1639 const ALLOCATOR& basicAllocator)
1640: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1642 this->insert(first, last);
1645template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1646template <
class INPUT_ITERATOR>
1648unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1649 INPUT_ITERATOR first,
1650 INPUT_ITERATOR last,
1651 size_type initialNumBuckets,
1652 const ALLOCATOR& basicAllocator)
1653: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1655 this->insert(first, last);
1658template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1659template <
class INPUT_ITERATOR>
1661unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1662 INPUT_ITERATOR first,
1663 INPUT_ITERATOR last,
1664 const ALLOCATOR& basicAllocator)
1665: d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
1667 this->insert(first, last);
1670#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1671template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1672#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1673template <
class,
class,
class>
1676unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1677 std::initializer_list<KEY> values,
1678 size_type initialNumBuckets,
1679 const hasher& hashFunction,
1680 const key_equal& keyEqual,
1681 const ALLOCATOR& basicAllocator)
1682: unordered_set(values.
begin(), values.
end(), initialNumBuckets,
1683 hashFunction, keyEqual, basicAllocator)
1687template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1688#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1689template <
class,
class>
1692unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1693 std::initializer_list<KEY> values,
1694 size_type initialNumBuckets,
1695 const HASH& hashFunction,
1696 const ALLOCATOR& basicAllocator)
1697: unordered_set(values.
begin(),
1706template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1707#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1711unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1712 std::initializer_list<KEY> values,
1713 size_type initialNumBuckets,
1714 const ALLOCATOR& basicAllocator)
1715: unordered_set(values.
begin(),
1724template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1725#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1729unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::unordered_set(
1730 std::initializer_list<KEY> values,
1731 const ALLOCATOR& basicAllocator)
1732: unordered_set(values.
begin(),
1743template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1745unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::~unordered_set()
1751template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1753unordered_set<KEY, HASH, EQUAL, ALLOCATOR>&
1754unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
const unordered_set& rhs)
1759 d_impl = rhs.d_impl;
1764template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1766unordered_set<KEY, HASH, EQUAL, ALLOCATOR>&
1767unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
1768 BloombergLP::bslmf::MovableRef<unordered_set> rhs)
1770 AllocatorTraits::is_always_equal::value
1771 && std::is_nothrow_move_assignable<HASH>::value
1772 && std::is_nothrow_move_assignable<EQUAL>::value)
1777 unordered_set& lvalue = rhs;
1779 d_impl = MoveUtil::move(lvalue.d_impl);
1784#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1785template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1787unordered_set<KEY, HASH, EQUAL, ALLOCATOR>&
1788unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
1789 std::initializer_list<KEY> values)
1791 unordered_set tmp(values, d_impl.allocator());
1793 d_impl.swap(tmp.d_impl);
1799template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1801typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
1804 return iterator(d_impl.elementListRoot());
1807template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1809typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
1815template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1817typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::local_iterator
1818unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::begin(size_type index)
1822 return local_iterator(&d_impl.bucketAtIndex(index));
1825template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1827typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::local_iterator
1828unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::end(size_type index)
1832 return local_iterator(0, &d_impl.bucketAtIndex(index));
1835template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1842#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1845#ifndef BSLSTL_UNORDEREDSET_VARIADIC_LIMIT
1846#define BSLSTL_UNORDEREDSET_VARIADIC_LIMIT 10
1848#ifndef BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B
1849#define BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B BSLSTL_UNORDEREDSET_VARIADIC_LIMIT
1851#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 0
1852template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1854pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
1855unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1860 bool isInsertedFlag =
false;
1862 HashTableLink *result = d_impl.emplaceIfMissing(
1865 return ResultType(iterator(result), isInsertedFlag);
1869#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 1
1870template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1871template <
class Args_01>
1873pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
1874unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1879 bool isInsertedFlag =
false;
1881 HashTableLink *result = d_impl.emplaceIfMissing(
1885 return ResultType(iterator(result), isInsertedFlag);
1889#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 2
1890template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1891template <
class Args_01,
1894pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
1895unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1901 bool isInsertedFlag =
false;
1903 HashTableLink *result = d_impl.emplaceIfMissing(
1908 return ResultType(iterator(result), isInsertedFlag);
1912#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 3
1913template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1914template <
class Args_01,
1918pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
1919unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1926 bool isInsertedFlag =
false;
1928 HashTableLink *result = d_impl.emplaceIfMissing(
1934 return ResultType(iterator(result), isInsertedFlag);
1938#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 4
1939template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1940template <
class Args_01,
1945pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
1946unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1954 bool isInsertedFlag =
false;
1956 HashTableLink *result = d_impl.emplaceIfMissing(
1963 return ResultType(iterator(result), isInsertedFlag);
1967#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 5
1968template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1969template <
class Args_01,
1975pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
1976unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1985 bool isInsertedFlag =
false;
1987 HashTableLink *result = d_impl.emplaceIfMissing(
1995 return ResultType(iterator(result), isInsertedFlag);
1999#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 6
2000template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2001template <
class Args_01,
2008pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
2009unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2019 bool isInsertedFlag =
false;
2021 HashTableLink *result = d_impl.emplaceIfMissing(
2030 return ResultType(iterator(result), isInsertedFlag);
2034#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 7
2035template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2036template <
class Args_01,
2044pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
2045unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2056 bool isInsertedFlag =
false;
2058 HashTableLink *result = d_impl.emplaceIfMissing(
2068 return ResultType(iterator(result), isInsertedFlag);
2072#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 8
2073template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2074template <
class Args_01,
2083pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
2084unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2096 bool isInsertedFlag =
false;
2098 HashTableLink *result = d_impl.emplaceIfMissing(
2109 return ResultType(iterator(result), isInsertedFlag);
2113#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 9
2114template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2115template <
class Args_01,
2125pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
2126unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2139 bool isInsertedFlag =
false;
2141 HashTableLink *result = d_impl.emplaceIfMissing(
2153 return ResultType(iterator(result), isInsertedFlag);
2157#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 10
2158template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2159template <
class Args_01,
2170pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
2171unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2185 bool isInsertedFlag =
false;
2187 HashTableLink *result = d_impl.emplaceIfMissing(
2200 return ResultType(iterator(result), isInsertedFlag);
2205#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 0
2206template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2208typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2209unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator)
2213 this->emplace().first;
2217#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 1
2218template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2219template <
class Args_01>
2221typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2222unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2232#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 2
2233template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2234template <
class Args_01,
2237typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2238unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2250#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 3
2251template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2252template <
class Args_01,
2256typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2257unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2271#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 4
2272template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2273template <
class Args_01,
2278typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2279unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2295#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 5
2296template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2297template <
class Args_01,
2303typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2304unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2322#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 6
2323template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2324template <
class Args_01,
2331typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2332unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2352#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 7
2353template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2354template <
class Args_01,
2362typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2363unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2385#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 8
2386template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2387template <
class Args_01,
2396typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2397unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2421#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 9
2422template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2423template <
class Args_01,
2433typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2434unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2460#if BSLSTL_UNORDEREDSET_VARIADIC_LIMIT_B >= 10
2461template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2462template <
class Args_01,
2473typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2474unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2505template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2506template <
class... Args>
2508pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
2509unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2514 bool isInsertedFlag =
false;
2516 HashTableLink *result = d_impl.emplaceIfMissing(
2519 return ResultType(iterator(result), isInsertedFlag);
2522template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2523template <
class... Args>
2525typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2526unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(const_iterator,
2536template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2539 typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator>
2540unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::equal_range(
const key_type& key)
2544 iterator first = this->find(key);
2545 if (first == this->
end()) {
2546 return ResultType(first, first);
2549 iterator next = first;
2550 return ResultType(first, ++next);
2554template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2556typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2557unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::erase(const_iterator position)
2561 return iterator(d_impl.remove(position.node()));
2564template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2566typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2567unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::erase(
const key_type& key)
2569 if (HashTableLink *target = d_impl.find(key)) {
2570 d_impl.remove(target);
2578template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2580typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2581unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::erase(const_iterator first,
2582 const_iterator last)
2584#if defined BDE_BUILD_TARGET_SAFE_2
2585 if (first != last) {
2586 iterator it = this->
begin();
2587 const iterator
end = this->end();
2588 for (; it != first; ++it) {
2592 for (; it != last; ++it) {
2598 while (first != last) {
2599 first = this->
erase(first);
2602 return iterator(first.node());
2605template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2607typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2608unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::find(
const key_type& key)
2610 return iterator(d_impl.find(key));
2613template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2616unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::insert(
const value_type& value)
2620 bool isInsertedFlag =
false;
2622 HashTableLink *result = d_impl.insertIfMissing(&isInsertedFlag, value);
2624 return ResultType(iterator(result), isInsertedFlag);
2627template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2630unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2631 BloombergLP::bslmf::MovableRef<value_type> value)
2635 bool isInsertedFlag =
false;
2637 HashTableLink *result = d_impl.insertIfMissing(&isInsertedFlag,
2638 MoveUtil::move(value));
2640 return ResultType(iterator(result), isInsertedFlag);
2643template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2645typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2646unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::insert(const_iterator,
2647 const value_type& value)
2657 return this->insert(value).first;
2660template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2662typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2663unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2665 BloombergLP::bslmf::MovableRef<value_type> value)
2675 return this->insert(MoveUtil::move(value)).first;
2678template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2679template <
class INPUT_ITERATOR>
2681void unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::insert(INPUT_ITERATOR first,
2682 INPUT_ITERATOR last)
2684 if (size_type maxInsertions =
static_cast<size_type
>(
2685 ::BloombergLP::bslstl::IteratorUtil::insertDistance(first, last))) {
2686 this->reserve(this->
size() + maxInsertions);
2689 bool isInsertedFlag;
2691 while (first != last) {
2692 d_impl.insertIfMissing(&isInsertedFlag, *first);
2697#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2698template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2700void unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2701 std::initializer_list<KEY> values)
2703 insert(values.begin(), values.end());
2707template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2709void unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::max_load_factor(
2710 float newLoadFactor)
2712 d_impl.setMaxLoadFactor(newLoadFactor);
2715template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2717void unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::rehash(size_type numBuckets)
2719 d_impl.rehashForNumBuckets(numBuckets);
2722template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2725unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::reserve(size_type numElements)
2727 d_impl.reserveForNumElements(numElements);
2730template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2732void unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::swap(unordered_set& other)
2734 AllocatorTraits::is_always_equal::value
2735 && bsl::is_nothrow_swappable<HASH>::value
2736 && bsl::is_nothrow_swappable<EQUAL>::value)
2738 d_impl.swap(other.d_impl);
2742template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2744ALLOCATOR unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::get_allocator() const
2747 return d_impl.allocator();
2750template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2752typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
2755 return const_iterator(d_impl.elementListRoot());
2758template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2760typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
2763 return const_iterator();
2766template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2768typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
2769unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::cbegin() const
2772 return const_iterator(d_impl.elementListRoot());
2775template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2777typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
2780 return const_iterator();
2783template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2785bool unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::contains(
2786 const key_type& key)
const
2788 return find(key) !=
end();
2791template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2796 return 0 == d_impl.size();
2799template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2801typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2804 return d_impl.size();
2807template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2809typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2810unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::max_size() const
2813 return AllocatorTraits::max_size(get_allocator());
2816template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2818typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::hasher
2819unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::hash_function()
const
2821 return d_impl.hasher();
2824template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2826typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::key_equal
2827unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::key_eq()
const
2829 return d_impl.comparator();
2832template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2834typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
2835unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::find(
const key_type& key)
const
2837 return const_iterator(d_impl.find(key));
2840template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2842typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2843unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::count(
const key_type& key)
const
2845 return 0 != d_impl.find(key);
2848template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2851 typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator>
2852unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::equal_range(
2853 const key_type& key)
const
2857 const_iterator first = this->find(key);
2858 if (first == this->end()) {
2859 return ResultType(first, first);
2862 const_iterator next = first;
2863 return ResultType(first, ++next);
2867template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2869typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2870unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::bucket_count() const
2873 return d_impl.numBuckets();
2876template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2878typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2879unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::max_bucket_count() const
2882 return d_impl.maxNumBuckets();
2885template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2887typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2888unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::bucket_size(size_type index)
const
2892 return d_impl.countElementsInBucket(index);
2895template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2897typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2898unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::bucket(
const key_type& key)
const
2902 return d_impl.bucketIndexForKey(key);
2905template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2907typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2908unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::begin(size_type index)
const
2912 return const_local_iterator(&d_impl.bucketAtIndex(index));
2915template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2917typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2918unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::end(size_type index)
const
2922 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
2925template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2927typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2928unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::cbegin(size_type index)
const
2932 return const_local_iterator(&d_impl.bucketAtIndex(index));
2935template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2937typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2938unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::cend(size_type index)
const
2942 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
2945template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2947float unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::load_factor() const
2950 return d_impl.loadFactor();
2953template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2955float unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::max_load_factor() const
2958 return d_impl.maxLoadFactor();
2964template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2970 return lhs.d_impl == rhs.d_impl;
2973#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
2974template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2980 return !(lhs == rhs);
2985template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR,
class PREDICATE>
2989 PREDICATE predicate)
2991 return BloombergLP::bslstl::AlgorithmUtil::containerEraseIf(s, predicate);
2994template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3020template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3021struct HasStlIterators<
bsl::unordered_set<KEY, HASH, EQUAL, ALLOCATOR> >
3029template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3030struct UsesBslmaAllocator<
bsl::unordered_set<KEY, HASH, EQUAL, ALLOCATOR> >
3039# error Not valid except when included from bslstl_unorderedset.h
#define BSLMF_NESTED_TRAIT_DECLARATION_IF(t_TYPE, t_TRAIT, t_COND)
Definition bslmf_nestedtraitdeclaration.h:243
Definition bslma_bslallocator.h:580
Definition bslstl_pair.h:1210
Definition bslstl_unorderedset.h:704
void swap(unordered_set &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:1219
EQUAL key_equal
Definition bslstl_unorderedset.h:753
AllocatorTraits::const_pointer const_pointer
Definition bslstl_unorderedset.h:761
void rehash(size_type numBuckets)
Definition bslstl_unorderedset.h:2384
pair< iterator, bool > insert(const value_type &value)
Definition bslstl_unorderedset.h:2283
EQUAL key_eq() const
Definition bslstl_unorderedset.h:2494
unordered_set &operator=(BloombergLP::bslmf::MovableRef< unordered_set > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2126
HASH hasher
Definition bslstl_unorderedset.h:752
HASH hash_function() const
Definition bslstl_unorderedset.h:2486
size_type bucket_size(size_type index) const
Definition bslstl_unorderedset.h:2555
size_type max_bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2546
AllocatorTraits::size_type size_type
Definition bslstl_unorderedset.h:758
ALLOCATOR allocator_type
Definition bslstl_unorderedset.h:754
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, pair< iterator, iterator > >::type equal_range(const LOOKUP_KEY &key)
Definition bslstl_unorderedset.h:1258
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, size_type >::type count(const LOOKUP_KEY &key) const
Definition bslstl_unorderedset.h:1400
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2436
friend bool operator==(const unordered_set< KEY2, HASH2, EQUAL2, ALLOCATOR2 > &, const unordered_set< KEY2, HASH2, EQUAL2, ALLOCATOR2 > &)
ALLOCATOR get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2411
KEY value_type
Definition bslstl_unorderedset.h:751
bool empty() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2461
bool contains(const key_type &key) const
Definition bslstl_unorderedset.h:2452
iterator emplace_hint(const_iterator hint, Args &&... arguments)
Definition bslstl_unorderedset.h:2187
size_type bucket(const key_type &key) const
Definition bslstl_unorderedset.h:2565
float load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2614
local_iterator const_local_iterator
Definition bslstl_unorderedset.h:768
::BloombergLP::bslstl::HashTableIterator< const value_type, difference_type > iterator
Definition bslstl_unorderedset.h:763
AllocatorTraits::difference_type difference_type
Definition bslstl_unorderedset.h:759
pair< iterator, bool > emplace(Args &&... arguments)
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, iterator >::type find(const LOOKUP_KEY &key)
Definition bslstl_unorderedset.h:1231
void reserve(size_type numElements)
Definition bslstl_unorderedset.h:2392
size_type max_size() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2477
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2445
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2134
iterator erase(const_iterator position)
Definition bslstl_unorderedset.h:2224
size_type bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2537
AllocatorTraits::pointer pointer
Definition bslstl_unorderedset.h:760
const value_type & const_reference
Definition bslstl_unorderedset.h:756
KEY key_type
Definition bslstl_unorderedset.h:750
float max_load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2622
unordered_set()
Definition bslstl_unorderedset.h:1861
::BloombergLP::bslstl::HashTableBucketIterator< const value_type, difference_type > local_iterator
Definition bslstl_unorderedset.h:765
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this set.
Definition bslstl_unorderedset.h:2469
iterator const_iterator
Definition bslstl_unorderedset.h:767
value_type & reference
Definition bslstl_unorderedset.h:755
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_KEYWORD_NOEXCEPT_OPERATOR(...)
Definition bsls_keyword.h:635
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:632
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:634
void swap(OptionValue &a, OptionValue &b)
bsl::size_t size(const TYPE &array)
Return the number of elements in the specified array.
Definition bdlb_printmethods.h:283
void swap(array< VALUE_TYPE, SIZE > &lhs, array< VALUE_TYPE, SIZE > &rhs)
deque< VALUE_TYPE, ALLOCATOR >::size_type erase(deque< VALUE_TYPE, ALLOCATOR > &deq, const BDE_OTHER_TYPE &value)
Definition bslstl_deque.h:4126
T::iterator begin(T &container)
Definition bslstl_iterator.h:1495
bool operator==(const memory_resource &a, const memory_resource &b)
T::iterator end(T &container)
Definition bslstl_iterator.h:1523
deque< VALUE_TYPE, ALLOCATOR >::size_type erase_if(deque< VALUE_TYPE, ALLOCATOR > &deq, PREDICATE predicate)
Definition bslstl_deque.h:4135
bool operator!=(const memory_resource &a, const memory_resource &b)
Definition bdlc_flathashmap.h:1805
Definition balxml_encoderoptions.h:68
Definition bdlbb_blob.h:576
Definition bdldfp_decimal.h:5188
Definition bslma_allocatortraits.h:1061
BloombergLP::bslma::AllocatorTraits_ConstPointerType< ALLOCATOR >::type const_pointer
Definition bslma_allocatortraits.h:1152
BloombergLP::bslma::AllocatorTraits_SizeType< ALLOCATOR >::type size_type
Definition bslma_allocatortraits.h:1165
BloombergLP::bslma::AllocatorTraits_PointerType< ALLOCATOR >::type pointer
Definition bslma_allocatortraits.h:1149
BloombergLP::bslma::AllocatorTraits_DifferenceType< ALLOCATOR >::type difference_type
Definition bslma_allocatortraits.h:1162
Definition bslstl_equalto.h:311
Definition bslstl_hash.h:498
Definition bslmf_isconvertible.h:867
t_TYPE type
Definition bslmf_typeidentity.h:216