8#ifndef INCLUDED_BSLSTL_UNORDEREDSET
9#define INCLUDED_BSLSTL_UNORDEREDSET
630#include <bslscm_version.h>
665#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
666#include <initializer_list>
669#ifdef BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER
670#include <type_traits>
673#if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
677# define COMPILING_BSLSTL_UNORDEREDSET_H
679# undef COMPILING_BSLSTL_UNORDEREDSET_H
716 typedef KEY ValueType;
721 typedef ::BloombergLP::bslstl::UnorderedSetKeyConfiguration<ValueType>
726 typedef ::BloombergLP::bslstl::HashTable<ListConfiguration,
729 ALLOCATOR> HashTable;
733 typedef ::BloombergLP::bslalg::BidirectionalLink HashTableLink;
737 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
740 template <
class KEY2,
762 typedef ::BloombergLP::bslstl::HashTableIterator<
764 typedef ::BloombergLP::bslstl::HashTableBucketIterator<
775 ::BloombergLP::bslmf::IsBitwiseMoveable,
776 ::BloombergLP::bslmf::IsBitwiseMoveable<HashTable>::value);
787 const HASH& hashFunction = HASH(),
788 const EQUAL& keyEqual = EQUAL(),
789 const ALLOCATOR& basicAllocator = ALLOCATOR());
791 const HASH& hashFunction,
792 const ALLOCATOR& basicAllocator);
794 const ALLOCATOR& basicAllocator);
864 BloombergLP::bslmf::MovableRef<unordered_set> original,
896 template <
class INPUT_ITERATOR>
900 const HASH& hashFunction = HASH(),
901 const EQUAL& keyEqual = EQUAL(),
902 const ALLOCATOR& basicAllocator = ALLOCATOR());
903 template <
class INPUT_ITERATOR>
907 const HASH& hashFunction,
908 const ALLOCATOR& basicAllocator);
909 template <
class INPUT_ITERATOR>
913 const ALLOCATOR& basicAllocator);
914 template <
class INPUT_ITERATOR>
917 const ALLOCATOR& basicAllocator);
919#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
920# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
922 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
923 class = bsl::enable_if_t<
924 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
925 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
929 size_type initialNumBuckets = 0,
930 const HASH& hashFunction = HASH(),
931 const EQUAL& keyEqual = EQUAL(),
932 const ALLOCATOR& basicAllocator = ALLOCATOR());
933# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
935 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
936 class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>
940 size_type initialNumBuckets,
941 const HASH& hashFunction,
942 const ALLOCATOR& basicAllocator);
943# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
944 template <class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>>
947 size_type initialNumBuckets,
948 const ALLOCATOR& basicAllocator);
949# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
972 template <class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>>
975 const ALLOCATOR& basicAllocator);
1009 operator=(BloombergLP::bslmf::MovableRef<unordered_set> rhs)
1011 AllocatorTraits::is_always_equal::value
1012 && std::is_nothrow_move_assignable<HASH>::value
1013 && std::is_nothrow_move_assignable<EQUAL>::value);
1015#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1023 unordered_set& operator=(std::initializer_list<KEY> values);
1070 BloombergLP::bslmf::MovableRef<value_type> value);
1100 BloombergLP::bslmf::MovableRef<value_type> value);
1114 template <class INPUT_ITERATOR>
1115 void
insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
1117#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1123 void
insert(std::initializer_list<KEY> values);
1126#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
1141 template <class... Args>
1161 template <class... Args>
1212 AllocatorTraits::is_always_equal::value
1213 && bsl::is_nothrow_swappable<HASH>::value
1214 && bsl::is_nothrow_swappable<EQUAL>::value);
1226 template <class LOOKUP_KEY>
1228 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1229 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1253 template <
class LOOKUP_KEY>
1255 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1256 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1263 HashTableLink *first = d_impl.find(key);
1334 template <class LOOKUP_KEY>
1336 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value &&
1337 BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,
1373 template <class LOOKUP_KEY>
1375 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1376 && BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1378 find(const LOOKUP_KEY& key)
const
1395 template <
class LOOKUP_KEY>
1397 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1398 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1403 return d_impl.find(key) != 0;
1422 template <
class LOOKUP_KEY>
1424 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1425 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1432 HashTableLink *first = d_impl.find(key);
1508#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1519 class INPUT_ITERATOR,
1520 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1524 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY&>>,
1525 class = bsl::enable_if_t<
1526 std::is_invocable_v<EQUAL, const KEY&, const KEY&>>,
1527 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1531 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1534 ALLOCATOR = ALLOCATOR())
1543 class INPUT_ITERATOR,
1544 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1548 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1549 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1553 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1566 class INPUT_ITERATOR,
1567 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1570 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1571 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1575 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1586 class INPUT_ITERATOR,
1587 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1590 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1591 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1595 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1605 class INPUT_ITERATOR,
1607 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1608 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1612 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1614->
unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1621 class INPUT_ITERATOR,
1622 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1624 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1625 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1629 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1638 class INPUT_ITERATOR,
1640 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1641 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1644->
unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1651 class INPUT_ITERATOR,
1652 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1654 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1655 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1669 class HASH = bsl::hash<KEY>,
1670 class EQUAL = bsl::equal_to<KEY>,
1671 class ALLOCATOR = bsl::allocator<KEY>,
1672 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY&>>,
1673 class = bsl::enable_if_t<
1674 std::is_invocable_v<EQUAL, const KEY&, const KEY&>>,
1675 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1678 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1681 ALLOCATOR = ALLOCATOR())
1694 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1695 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1698 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1714 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1715 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1718 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1733 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1734 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1737 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1749 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1752 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1754->
unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1763 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1764 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1767 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1778 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1781->
unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1790 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1791 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1806template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1807bool operator==(const unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& lhs,
1808 const unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& rhs);
1810#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
1811template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1812bool operator!=(const unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& lhs,
1813 const unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& rhs);
1828template <class KEY, class HASH, class EQUAL, class ALLOCATOR, class PREDICATE>
1830erase_if(unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& s, PREDICATE predicate);
1832template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1833void swap(unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& a,
1834 unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& b)
1836 BSLS_KEYWORD_NOEXCEPT_OPERATOR(a.swap(b)));
1859template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1862: d_impl(HASH(), EQUAL(), 0, 1.0f, ALLOCATOR())
1866template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1870 const HASH& hashFunction,
1871 const EQUAL& keyEqual,
1872 const ALLOCATOR& basicAllocator)
1873: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1877template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1881 const HASH& hashFunction,
1882 const ALLOCATOR& basicAllocator)
1883: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1887template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1891 const ALLOCATOR& basicAllocator)
1892: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1896template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1899 const ALLOCATOR& basicAllocator)
1900: d_impl(basicAllocator)
1904template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1908: d_impl(original.d_impl,
1910 original.get_allocator()))
1914template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1917 BloombergLP::bslmf::MovableRef<unordered_set> original)
1918: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl))
1922template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1927: d_impl(original.d_impl, basicAllocator)
1931template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1934 BloombergLP::bslmf::MovableRef<unordered_set> original,
1936: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl), basicAllocator)
1940template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1941template <
class INPUT_ITERATOR>
1944 INPUT_ITERATOR first,
1945 INPUT_ITERATOR last,
1947 const HASH& hashFunction,
1948 const EQUAL& keyEqual,
1949 const ALLOCATOR& basicAllocator)
1950: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1952 this->
insert(first, last);
1955template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1956template <
class INPUT_ITERATOR>
1959 INPUT_ITERATOR first,
1960 INPUT_ITERATOR last,
1962 const HASH& hashFunction,
1963 const ALLOCATOR& basicAllocator)
1964: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1966 this->
insert(first, last);
1969template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1970template <
class INPUT_ITERATOR>
1973 INPUT_ITERATOR first,
1974 INPUT_ITERATOR last,
1976 const ALLOCATOR& basicAllocator)
1977: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1979 this->
insert(first, last);
1982template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1983template <
class INPUT_ITERATOR>
1986 INPUT_ITERATOR first,
1987 INPUT_ITERATOR last,
1988 const ALLOCATOR& basicAllocator)
1989: d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
1991 this->
insert(first, last);
1994#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1995template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1996#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1997template <
class,
class,
class>
2001 std::initializer_list<KEY> values,
2002 size_type initialNumBuckets,
2003 const hasher& hashFunction,
2004 const key_equal& keyEqual,
2005 const ALLOCATOR& basicAllocator)
2007 hashFunction, keyEqual, basicAllocator)
2011template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2012#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2013template <
class,
class>
2017 std::initializer_list<KEY> values,
2018 size_type initialNumBuckets,
2019 const HASH& hashFunction,
2020 const ALLOCATOR& basicAllocator)
2021: unordered_set(values.
begin(),
2030template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2031#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2036 std::initializer_list<KEY> values,
2037 size_type initialNumBuckets,
2038 const ALLOCATOR& basicAllocator)
2039: unordered_set(values.
begin(),
2048template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2049#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2054 std::initializer_list<KEY> values,
2055 const ALLOCATOR& basicAllocator)
2056: unordered_set(values.
begin(),
2067template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2075template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2083 d_impl = rhs.d_impl;
2088template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2092 BloombergLP::bslmf::MovableRef<unordered_set> rhs)
2094 AllocatorTraits::is_always_equal::value
2095 && std::is_nothrow_move_assignable<HASH>::value
2096 && std::is_nothrow_move_assignable<EQUAL>::value)
2103 d_impl = MoveUtil::move(lvalue.d_impl);
2108#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2109template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2111unordered_set<KEY, HASH, EQUAL, ALLOCATOR>&
2113 std::initializer_list<KEY> values)
2115 unordered_set tmp(values, d_impl.allocator());
2117 d_impl.swap(tmp.d_impl);
2123template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2128 return iterator(d_impl.elementListRoot());
2131template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2139template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2149template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2159template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2166#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
2167template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2168template <
class... Args>
2170pair<typename unordered_set<KEY, HASH, EQUAL, ALLOCATOR>::iterator,
bool>
2175 bool isInsertedFlag =
false;
2177 HashTableLink *result = d_impl.emplaceIfMissing(
2180 return ResultType(
iterator(result), isInsertedFlag);
2183template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2184template <
class... Args>
2188 Args&&... arguments)
2203template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2212 if (first == this->
end()) {
2213 return ResultType(first, first);
2217 return ResultType(first, ++next);
2221template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2228 return iterator(d_impl.remove(position.node()));
2231template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2236 if (HashTableLink *target = d_impl.find(key)) {
2237 d_impl.remove(target);
2245template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2251#if defined BDE_BUILD_TARGET_SAFE_2
2252 if (first != last) {
2254 const iterator
end = this->
end();
2255 for (; it != first; ++it) {
2259 for (; it != last; ++it) {
2265 while (first != last) {
2266 first = this->
erase(first);
2272template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2280template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2287 bool isInsertedFlag =
false;
2289 HashTableLink *result = d_impl.insertIfMissing(&isInsertedFlag, value);
2291 return ResultType(
iterator(result), isInsertedFlag);
2294template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2298 BloombergLP::bslmf::MovableRef<value_type> value)
2302 bool isInsertedFlag =
false;
2304 HashTableLink *result = d_impl.insertIfMissing(&isInsertedFlag,
2305 MoveUtil::move(value));
2307 return ResultType(
iterator(result), isInsertedFlag);
2310template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2324 return this->insert(value).first;
2327template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2332 BloombergLP::bslmf::MovableRef<value_type> value)
2342 return this->insert(MoveUtil::move(value)).first;
2345template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2346template <
class INPUT_ITERATOR>
2349 INPUT_ITERATOR last)
2352 ::BloombergLP::bslstl::IteratorUtil::insertDistance(first, last))) {
2353 this->reserve(this->
size() + maxInsertions);
2356 bool isInsertedFlag;
2358 while (first != last) {
2359 d_impl.insertIfMissing(&isInsertedFlag, *first);
2364#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2365template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2368 std::initializer_list<KEY> values)
2370 insert(values.begin(), values.end());
2374template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2377 float newLoadFactor)
2379 d_impl.setMaxLoadFactor(newLoadFactor);
2382template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2386 d_impl.rehashForNumBuckets(numBuckets);
2389template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2394 d_impl.reserveForNumElements(numElements);
2397template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2401 AllocatorTraits::is_always_equal::value
2402 && bsl::is_nothrow_swappable<HASH>::value
2403 && bsl::is_nothrow_swappable<EQUAL>::value)
2405 d_impl.swap(other.d_impl);
2409template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2414 return d_impl.allocator();
2417template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2425template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2433template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2442template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2450template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2455 return find(key) !=
end();
2458template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2463 return 0 == d_impl.size();
2466template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2471 return d_impl.size();
2474template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2480 return AllocatorTraits::max_size(get_allocator());
2483template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2488 return d_impl.hasher();
2491template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2496 return d_impl.comparator();
2499template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2507template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2512 return 0 != d_impl.find(key);
2515template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2525 if (first == this->
end()) {
2526 return ResultType(first, first);
2530 return ResultType(first, ++next);
2534template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2540 return d_impl.numBuckets();
2543template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2549 return d_impl.maxNumBuckets();
2552template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2559 return d_impl.countElementsInBucket(index);
2562template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2569 return d_impl.bucketIndexForKey(key);
2572template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2582template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2592template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2602template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2612template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2617 return d_impl.loadFactor();
2620template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2625 return d_impl.maxLoadFactor();
2631template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2633bool bsl::operator==(
2637 return lhs.d_impl == rhs.d_impl;
2640#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
2641template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2647 return !(lhs == rhs);
2652template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR,
class PREDICATE>
2656 PREDICATE predicate)
2658 return BloombergLP::bslstl::AlgorithmUtil::containerEraseIf(s, predicate);
2661template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2687template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2696template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
Definition ball_attribute.h:198
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
unordered_set & operator=(const unordered_set &rhs)
Definition bslstl_unorderedset.h:2078
EQUAL key_equal
Definition bslstl_unorderedset.h:753
AllocatorTraits::const_pointer const_pointer
Definition bslstl_unorderedset.h:761
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, pair< const_iterator, const_iterator > >::type equal_range(const LOOKUP_KEY &key) const
Definition bslstl_unorderedset.h:1427
void rehash(size_type numBuckets)
Definition bslstl_unorderedset.h:2384
pair< iterator, iterator > equal_range(const key_type &key)
Definition bslstl_unorderedset.h:2207
unordered_set(INPUT_ITERATOR first, INPUT_ITERATOR last, size_type initialNumBuckets, const ALLOCATOR &basicAllocator)
Definition bslstl_unorderedset.h:1972
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
pair< const_iterator, const_iterator > equal_range(const key_type &key) const
Definition bslstl_unorderedset.h:2519
unordered_set(BloombergLP::bslmf::MovableRef< unordered_set > original)
Definition bslstl_unorderedset.h:1916
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
unordered_set(const ALLOCATOR &basicAllocator)
Definition bslstl_unorderedset.h:1898
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 > &)
void max_load_factor(float newLoadFactor)
Definition bslstl_unorderedset.h:2376
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
~unordered_set()
Destroy this object.
Definition bslstl_unorderedset.h:2069
iterator find(const key_type &key)
Definition bslstl_unorderedset.h:2275
unordered_set(const unordered_set &original, const typename type_identity< ALLOCATOR >::type &basicAllocator)
Definition bslstl_unorderedset.h:1924
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
unordered_set(BloombergLP::bslmf::MovableRef< unordered_set > original, const typename type_identity< ALLOCATOR >::type &basicAllocator)
Definition bslstl_unorderedset.h:1933
unordered_set(size_type initialNumBuckets, const ALLOCATOR &basicAllocator)
Definition bslstl_unorderedset.h:1889
AllocatorTraits::difference_type difference_type
Definition bslstl_unorderedset.h:759
pair< iterator, bool > emplace(Args &&... arguments)
size_type count(const key_type &key) const
Definition bslstl_unorderedset.h:2510
unordered_set(const unordered_set &original)
Definition bslstl_unorderedset.h:1906
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 find(const key_type &key) const
Definition bslstl_unorderedset.h:2502
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2445
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2134
unordered_set(INPUT_ITERATOR first, INPUT_ITERATOR last, const ALLOCATOR &basicAllocator)
Definition bslstl_unorderedset.h:1985
iterator erase(const_iterator position)
Definition bslstl_unorderedset.h:2224
unordered_set(size_type initialNumBuckets, const HASH &hashFunction, const ALLOCATOR &basicAllocator)
Definition bslstl_unorderedset.h:1879
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
BSLMF_NESTED_TRAIT_DECLARATION_IF(unordered_set, ::BloombergLP::bslmf::IsBitwiseMoveable, ::BloombergLP::bslmf::IsBitwiseMoveable< HashTable >::value)
KEY key_type
Definition bslstl_unorderedset.h:750
float max_load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedset.h:2622
unordered_set(INPUT_ITERATOR first, INPUT_ITERATOR last, size_type initialNumBuckets, const HASH &hashFunction, const ALLOCATOR &basicAllocator)
Definition bslstl_unorderedset.h:1958
unordered_set()
Definition bslstl_unorderedset.h:1861
::BloombergLP::bslstl::HashTableBucketIterator< const value_type, difference_type > local_iterator
Definition bslstl_unorderedset.h:765
unordered_set(size_type initialNumBuckets, const HASH &hashFunction=HASH(), const EQUAL &keyEqual=EQUAL(), const ALLOCATOR &basicAllocator=ALLOCATOR())
Definition bslstl_unorderedset.h:1868
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
unordered_set(INPUT_ITERATOR first, INPUT_ITERATOR last, size_type initialNumBuckets=0, const HASH &hashFunction=HASH(), const EQUAL &keyEqual=EQUAL(), const ALLOCATOR &basicAllocator=ALLOCATOR())
Definition bslstl_unorderedset.h:1943
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(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#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
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
BSLS_KEYWORD_CONSTEXPR size_t size(const TYPE(&)[DIMENSION]) BSLS_KEYWORD_NOEXCEPT
Return the dimension of the specified array argument.
Definition bslstl_iterator.h:1331
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 bslmf_enableif.h:525
Definition bslstl_equalto.h:311
Definition bslstl_hash.h:498
Definition bslmf_isconvertible.h:867
t_TYPE type
Definition bslmf_typeidentity.h:216
Definition bslalg_hasstliterators.h:99
Definition bslma_usesbslmaallocator.h:343