11#ifndef INCLUDED_BSLSTL_UNORDEREDMULTISET_CPP03
12#define INCLUDED_BSLSTL_UNORDEREDMULTISET_CPP03
63#ifdef COMPILING_BSLSTL_UNORDEREDMULTISET_H
85class unordered_multiset
98 typedef KEY ValueType;
103 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_multiset<KEY2, HASH2, EQUAL2, ALLOCATOR2>&,
129 const unordered_multiset<KEY2, HASH2, EQUAL2, ALLOCATOR2>&);
146 typedef ::BloombergLP::bslstl::HashTableIterator<
149 typedef ::BloombergLP::bslstl::HashTableBucketIterator<
159 ::BloombergLP::bslmf::IsBitwiseMoveable,
160 ::BloombergLP::bslmf::IsBitwiseMoveable<HashTable>::value);
171 const HASH& hashFunction = HASH(),
172 const EQUAL& keyEqual = EQUAL(),
173 const ALLOCATOR& basicAllocator = ALLOCATOR());
175 const HASH& hashFunction,
176 const ALLOCATOR& basicAllocator);
178 const ALLOCATOR& basicAllocator);
221 BloombergLP::bslmf::MovableRef<unordered_multiset> original);
252 BloombergLP::bslmf::MovableRef<unordered_multiset> original,
283 template <
class INPUT_ITERATOR>
287 const HASH& hashFunction = HASH(),
288 const EQUAL& keyEqual = EQUAL(),
289 const ALLOCATOR& basicAllocator = ALLOCATOR());
290 template <
class INPUT_ITERATOR>
294 const HASH& hashFunction,
295 const ALLOCATOR& basicAllocator);
296 template <
class INPUT_ITERATOR>
300 const ALLOCATOR& basicAllocator);
301 template <
class INPUT_ITERATOR>
304 const ALLOCATOR& basicAllocator);
306#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
307# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
309 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
310 class = bsl::enable_if_t<
311 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
312 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
316 std::initializer_list<KEY> values,
317 size_type initialNumBuckets = 0,
318 const HASH& hashFunction = HASH(),
319 const EQUAL& keyEqual = EQUAL(),
320 const ALLOCATOR& basicAllocator = ALLOCATOR());
321# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
323 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
324 class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>
328 size_type initialNumBuckets,
329 const HASH& hashFunction,
330 const ALLOCATOR& basicAllocator);
331# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
332 template <class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>>
335 size_type initialNumBuckets,
336 const ALLOCATOR& basicAllocator);
337# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
359 template <class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>>
362 const ALLOCATOR& basicAllocator);
397 operator=(BloombergLP::bslmf::MovableRef<unordered_multiset> rhs)
399 AllocatorTraits::is_always_equal::value
400 && std::is_nothrow_move_assignable<HASH>::value
401 && std::is_nothrow_move_assignable<EQUAL>::value);
403#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
451 template <class LOOKUP_KEY>
453 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
454 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
455 pair<iterator, iterator> >::type
460 HashTableLink *first;
462 d_impl.findRange(&first, &last, key);
463 return ResultType(iterator(first), iterator(last));
514 template <
class LOOKUP_KEY>
516 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
517 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
519 find(
const LOOKUP_KEY& key)
549 iterator insert(BloombergLP::bslmf::MovableRef<value_type> value);
584 BloombergLP::bslmf::MovableRef<value_type> value);
598 template <
class INPUT_ITERATOR>
599 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
601#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
607 void insert(std::initializer_list<KEY> values);
610#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
613#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
614#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT 10
616#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A
617#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
619#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 0
623#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 1
624 template <
class Args_01>
628#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 2
629 template <
class Args_01,
635#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 3
636 template <
class Args_01,
644#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 4
645 template <
class Args_01,
655#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 5
656 template <
class Args_01,
668#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 6
669 template <
class Args_01,
683#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 7
684 template <
class Args_01,
700#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 8
701 template <
class Args_01,
719#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 9
720 template <
class Args_01,
740#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 10
741 template <
class Args_01,
764#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 0
768#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 1
769 template <
class Args_01>
774#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 2
775 template <
class Args_01,
782#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 3
783 template <
class Args_01,
792#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 4
793 template <
class Args_01,
804#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 5
805 template <
class Args_01,
818#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 6
819 template <
class Args_01,
834#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 7
835 template <
class Args_01,
852#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 8
853 template <
class Args_01,
872#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 9
873 template <
class Args_01,
894#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 10
895 template <
class Args_01,
921 template <
class... Args>
924 template <
class... Args>
968 AllocatorTraits::is_always_equal::value
969 && bsl::is_nothrow_swappable<HASH>::value
970 && bsl::is_nothrow_swappable<EQUAL>::value);
999 template <class LOOKUP_KEY>
1001 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value &&
1002 BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,
1005 contains(const LOOKUP_KEY& key)
const
1041 template <class LOOKUP_KEY>
1043 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1044 && BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1046 find(const LOOKUP_KEY& key)
const
1062 template <
class LOOKUP_KEY>
1064 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1065 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1067 count(
const LOOKUP_KEY& key)
const
1070 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
1073 for (HashTableLink *cursor = d_impl.find(key);
1075 ++result, cursor = cursor->nextLink()) {
1077 BNode *cursorNode =
static_cast<BNode *
>(cursor);
1080 ListConfiguration::extractKey(cursorNode->value()))) {
1100 template <
class LOOKUP_KEY>
1102 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1103 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1104 pair<const_iterator, const_iterator> >::type
1109 HashTableLink *first;
1110 HashTableLink *last;
1111 d_impl.findRange(&first, &last, key);
1183#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1194 class INPUT_ITERATOR,
1195 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1199 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY&>>,
1200 class = bsl::enable_if_t<
1201 std::is_invocable_v<EQUAL, const KEY&, const KEY&>>,
1202 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1206 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1209 ALLOCATOR = ALLOCATOR())
1218 class INPUT_ITERATOR,
1219 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1223 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1224 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>>
1272 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1282 class INPUT_ITERATOR,
1284 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1285 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1289 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1298 class INPUT_ITERATOR,
1299 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1301 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1302 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1307 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1316 class INPUT_ITERATOR,
1318 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1319 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1329 class INPUT_ITERATOR,
1330 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1332 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1333 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1347 class HASH = bsl::hash<KEY>,
1348 class EQUAL = bsl::equal_to<KEY>,
1349 class ALLOCATOR = bsl::allocator<KEY>,
1350 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY&>>,
1351 class = bsl::enable_if_t<
1352 std::is_invocable_v<EQUAL, const KEY&, const KEY&>>,
1353 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1356 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1359 ALLOCATOR = ALLOCATOR())
1373 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1374 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1377 std::initializer_list<KEY>,
1378 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1394 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1395 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1398 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1413 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1414 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1417 std::initializer_list<KEY>,
1418 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1430 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1433 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1444 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1445 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1448 std::initializer_list<KEY>,
1449 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1460 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1472 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1473 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1488template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1489bool operator==(const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& lhs,
1490 const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& rhs);
1492#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
1493template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1494bool operator!=(const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& lhs,
1495 const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& rhs);
1510template <class KEY, class HASH, class EQUAL, class ALLOCATOR, class PREDICATE>
1512erase_if(unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& ms,
1513 PREDICATE predicate);
1515template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1516void
swap(unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& a,
1517 unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& b)
1519 BSLS_KEYWORD_NOEXCEPT_OPERATOR(a.swap(b)));
1542template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1545: d_impl(HASH(), EQUAL(), 0, 1.0f, ALLOCATOR())
1549template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1553 const HASH& hashFunction,
1554 const EQUAL& keyEqual,
1555 const ALLOCATOR& basicAllocator)
1556: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1560template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1562unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1563 size_type initialNumBuckets,
1564 const HASH& hashFunction,
1565 const ALLOCATOR& basicAllocator)
1566: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1570template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1572unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1573 size_type initialNumBuckets,
1574 const ALLOCATOR& basicAllocator)
1575: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1579template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1581unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1582 const ALLOCATOR& basicAllocator)
1583: d_impl(basicAllocator)
1587template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1589unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1590 const unordered_multiset& original)
1591: d_impl(original.d_impl,
1592 AllocatorTraits::select_on_container_copy_construction(
1593 original.get_allocator()))
1597template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1599unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1600 BloombergLP::bslmf::MovableRef<unordered_multiset> original)
1601: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl))
1605template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1607unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1608 const unordered_multiset& original,
1609 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1610: d_impl(original.d_impl, basicAllocator)
1614template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1616unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1617 BloombergLP::bslmf::MovableRef<unordered_multiset> original,
1618 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1619: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl), basicAllocator)
1623template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1624template <
class INPUT_ITERATOR>
1626unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1627 INPUT_ITERATOR first,
1628 INPUT_ITERATOR last,
1629 size_type initialNumBuckets,
1630 const HASH& hashFunction,
1631 const EQUAL& keyEqual,
1632 const ALLOCATOR& basicAllocator)
1633: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1635 this->insert(first, last);
1638template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1639template <
class INPUT_ITERATOR>
1641unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1642 INPUT_ITERATOR first,
1643 INPUT_ITERATOR last,
1644 size_type initialNumBuckets,
1645 const HASH& hashFunction,
1646 const ALLOCATOR& basicAllocator)
1647: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1649 this->insert(first, last);
1652template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1653template <
class INPUT_ITERATOR>
1655unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1656 INPUT_ITERATOR first,
1657 INPUT_ITERATOR last,
1658 size_type initialNumBuckets,
1659 const ALLOCATOR& basicAllocator)
1660: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1662 this->insert(first, last);
1665template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1666template <
class INPUT_ITERATOR>
1668unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1669 INPUT_ITERATOR first,
1670 INPUT_ITERATOR last,
1671 const ALLOCATOR& basicAllocator)
1672: d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
1674 this->insert(first, last);
1677#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1678template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1679#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1680template <
class,
class,
class>
1683unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1684 std::initializer_list<KEY> values,
1685 size_type initialNumBuckets,
1686 const hasher& hashFunction,
1687 const key_equal& keyEqual,
1688 const ALLOCATOR& basicAllocator)
1689: unordered_multiset(values.
begin(),
1698template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1699#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1700template <
class,
class>
1703unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1704 std::initializer_list<KEY> values,
1705 size_type initialNumBuckets,
1706 const HASH& hashFunction,
1707 const ALLOCATOR& basicAllocator)
1708: unordered_multiset(values.
begin(),
1717template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1718#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1722unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1723 std::initializer_list<KEY> values,
1724 size_type initialNumBuckets,
1725 const ALLOCATOR& basicAllocator)
1726: unordered_multiset(values.
begin(),
1735template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1736#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1740unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1741 std::initializer_list<KEY> values,
1742 const ALLOCATOR& basicAllocator)
1743: unordered_multiset(values.
begin(),
1753template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1755unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::~unordered_multiset()
1761template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1763unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>&
1764unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
1765 const unordered_multiset& rhs)
1770 d_impl = rhs.d_impl;
1775template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1777unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>&
1778unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
1779 BloombergLP::bslmf::MovableRef<unordered_multiset> rhs)
1781 AllocatorTraits::is_always_equal::value
1782 && std::is_nothrow_move_assignable<HASH>::value
1783 && std::is_nothrow_move_assignable<EQUAL>::value)
1788 unordered_multiset& lvalue = rhs;
1790 d_impl = MoveUtil::move(lvalue.d_impl);
1795#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1796template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1798unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>&
1799unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
1800 std::initializer_list<KEY> values)
1802 unordered_multiset tmp(values, d_impl.allocator());
1804 d_impl.swap(tmp.d_impl);
1810#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1813#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
1814#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT 10
1816#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B
1817#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
1819#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 0
1820template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1822typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
1823unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1826 return iterator(d_impl.emplace(
1832#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 1
1833template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1834template <
class Args_01>
1836typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
1837unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1840 return iterator(d_impl.emplace(
1846#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 2
1847template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1848template <
class Args_01,
1851typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
1852unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1856 return iterator(d_impl.emplace(
1863#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 3
1864template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1865template <
class Args_01,
1869typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
1870unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1875 return iterator(d_impl.emplace(
1883#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 4
1884template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1885template <
class Args_01,
1890typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
1891unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1897 return iterator(d_impl.emplace(
1906#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 5
1907template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1908template <
class Args_01,
1914typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
1915unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1922 return iterator(d_impl.emplace(
1932#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 6
1933template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1934template <
class Args_01,
1941typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
1942unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1950 return iterator(d_impl.emplace(
1961#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 7
1962template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1963template <
class Args_01,
1971typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
1972unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
1981 return iterator(d_impl.emplace(
1993#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 8
1994template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1995template <
class Args_01,
2004typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2005unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2015 return iterator(d_impl.emplace(
2028#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 9
2029template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2030template <
class Args_01,
2040typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2041unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2052 return iterator(d_impl.emplace(
2066#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 10
2067template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2068template <
class Args_01,
2079typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2080unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2092 return iterator(d_impl.emplace(
2108#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 0
2109template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2111typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2112unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2113 const_iterator hint)
2115 return iterator(d_impl.emplaceWithHint(hint.node()));
2119#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 1
2120template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2121template <
class Args_01>
2123typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2124unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2125 const_iterator hint,
2128 return iterator(d_impl.emplaceWithHint(hint.node(),
2133#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 2
2134template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2135template <
class Args_01,
2138typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2139unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2140 const_iterator hint,
2144 return iterator(d_impl.emplaceWithHint(hint.node(),
2150#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 3
2151template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2152template <
class Args_01,
2156typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2157unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2158 const_iterator hint,
2163 return iterator(d_impl.emplaceWithHint(hint.node(),
2170#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 4
2171template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2172template <
class Args_01,
2177typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2178unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2179 const_iterator hint,
2185 return iterator(d_impl.emplaceWithHint(hint.node(),
2193#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 5
2194template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2195template <
class Args_01,
2201typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2202unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2203 const_iterator hint,
2210 return iterator(d_impl.emplaceWithHint(hint.node(),
2219#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 6
2220template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2221template <
class Args_01,
2228typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2229unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2230 const_iterator hint,
2238 return iterator(d_impl.emplaceWithHint(hint.node(),
2248#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 7
2249template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2250template <
class Args_01,
2258typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2259unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2260 const_iterator hint,
2269 return iterator(d_impl.emplaceWithHint(hint.node(),
2280#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 8
2281template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2282template <
class Args_01,
2291typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2292unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2293 const_iterator hint,
2303 return iterator(d_impl.emplaceWithHint(hint.node(),
2315#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 9
2316template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2317template <
class Args_01,
2327typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2328unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2329 const_iterator hint,
2340 return iterator(d_impl.emplaceWithHint(hint.node(),
2353#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 10
2354template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2355template <
class Args_01,
2366typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2367unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2368 const_iterator hint,
2380 return iterator(d_impl.emplaceWithHint(hint.node(),
2397template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2398template <
class... Args>
2400typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2401unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2404 return iterator(d_impl.emplace(
2409template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2410template <
class... Args>
2412typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2413unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2414 const_iterator hint,
2417 return iterator(d_impl.emplaceWithHint(hint.node(),
2423template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2425typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2428 return iterator(d_impl.elementListRoot());
2431template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2433typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2439template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2441typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::local_iterator
2442unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::begin(size_type index)
2446 return local_iterator(&d_impl.bucketAtIndex(index));
2449template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2451typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::local_iterator
2452unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::end(size_type index)
2456 return local_iterator(0, &d_impl.bucketAtIndex(index));
2459template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2467template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2468typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2469unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::find(
const key_type& key)
2471 return iterator(d_impl.find(key));
2474template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2477 typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator>
2478unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::equal_range(
2479 const key_type& key)
2481 HashTableLink *first;
2482 HashTableLink *last;
2483 d_impl.findRange(&first, &last, key);
2487template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2489typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2490unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::erase(const_iterator position)
2494 return iterator(d_impl.remove(position.node()));
2497template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2498typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2499unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::erase(
const key_type& key)
2501 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
2503 HashTableLink *target = d_impl.find(key);
2505 target = d_impl.remove(target);
2506 size_type result = 1;
2508 this->key_eq()(key, ListConfiguration::extractKey(
2509 static_cast<BNode *
>(target)->value()))) {
2510 target = d_impl.remove(target);
2519template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2520typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2521unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::erase(const_iterator first,
2522 const_iterator last)
2525#if defined BDE_BUILD_TARGET_SAFE_2
2526 if (first != last) {
2527 iterator it = this->
begin();
2528 const iterator
end = this->end();
2529 for (; it != first; ++it) {
2533 for (; it != last; ++it) {
2539 while (first != last) {
2540 first = this->
erase(first);
2543 return iterator(first.node());
2546template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2548typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2549unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2550 const value_type& value)
2552 return iterator(d_impl.insert(value));
2555template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2557typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2558unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2559 BloombergLP::bslmf::MovableRef<value_type> value)
2561 return iterator(d_impl.insert(MoveUtil::move(value)));
2564template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2566typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2567unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2568 const_iterator hint,
2569 const value_type& value)
2571 return iterator(d_impl.insert(value, hint.node()));
2574template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2576typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2577unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2578 const_iterator hint,
2579 BloombergLP::bslmf::MovableRef<value_type> value)
2581 return iterator(d_impl.insert(MoveUtil::move(value), hint.node()));
2584template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2585template <
class INPUT_ITERATOR>
2587unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(INPUT_ITERATOR first,
2588 INPUT_ITERATOR last)
2590 difference_type maxInsertions =
2591 ::BloombergLP::bslstl::IteratorUtil::insertDistance(first, last);
2592 if (maxInsertions) {
2593 this->reserve(this->
size() + maxInsertions);
2596 while (first != last) {
2597 d_impl.insert(*first);
2602#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2603template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2605void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2606 std::initializer_list<KEY> values)
2608 insert(values.begin(), values.end());
2612template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2614void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_load_factor(
2615 float newLoadFactor)
2617 d_impl.setMaxLoadFactor(newLoadFactor);
2620template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2623unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::rehash(size_type numBuckets)
2625 d_impl.rehashForNumBuckets(numBuckets);
2628template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2631unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::reserve(size_type numElements)
2633 d_impl.reserveForNumElements(numElements);
2636template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2639unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::swap(
2640 unordered_multiset& other)
2642 AllocatorTraits::is_always_equal::value
2643 && bsl::is_nothrow_swappable<HASH>::value
2644 && bsl::is_nothrow_swappable<EQUAL>::value)
2646 d_impl.swap(other.d_impl);
2650template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2653unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::get_allocator() const
2656 return d_impl.allocator();
2659template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2661typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
2662unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::begin() const
2665 return const_iterator(d_impl.elementListRoot());
2668template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2670typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
2671unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::end() const
2674 return const_iterator();
2677template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2679typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
2680unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cbegin() const
2683 return const_iterator(d_impl.elementListRoot());
2686template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2688typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
2689unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cend() const
2692 return const_iterator();
2695template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2697typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2698unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::begin(size_type index)
const
2702 return const_local_iterator(&d_impl.bucketAtIndex(index));
2705template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2708 unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2709unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::end(size_type index)
const
2713 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
2717template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2720 unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2721unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cbegin(size_type index)
const
2725 return const_local_iterator(&d_impl.bucketAtIndex(index));
2728template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2730typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2731unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cend(size_type index)
const
2735 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
2738template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2740typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2741unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::bucket(
2742 const key_type& key)
const
2744 return d_impl.bucketIndexForKey(key);
2747template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2749typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2750unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::bucket_count() const
2753 return d_impl.numBuckets();
2756template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2758typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2759unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::bucket_size(
2760 size_type index)
const
2764 return d_impl.countElementsInBucket(index);
2767template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2768typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2769unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::count(
2770 const key_type& key)
const
2772 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
2774 size_type result = 0;
2775 for (HashTableLink *cursor = d_impl.find(key);
2777 ++result, cursor = cursor->nextLink()) {
2779 BNode *cursorNode =
static_cast<BNode *
>(cursor);
2780 if (!this->key_eq()(
2782 ListConfiguration::extractKey(cursorNode->value()))) {
2789template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2791typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
2792unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::find(
2793 const key_type& key)
const
2795 return const_iterator(d_impl.find(key));
2798template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2800bool unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::contains(
2801 const key_type& key)
const
2803 return find(key) !=
end();
2807template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2810unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::empty() const
2813 return 0 == d_impl.size();
2816template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2818typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2819unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size() const
2822 return d_impl.size();
2825template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2827typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2828unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_size() const
2831 return AllocatorTraits::max_size(get_allocator());
2834template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2836typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::hasher
2837unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::hash_function()
const
2839 return d_impl.hasher();
2842template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2844typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::key_equal
2845unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::key_eq()
const
2847 return d_impl.comparator();
2850template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2853 typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator,
2854 typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator>
2855unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::equal_range(
2856 const key_type& key)
const
2858 HashTableLink *first;
2859 HashTableLink *last;
2860 d_impl.findRange(&first, &last, key);
2862 const_iterator(last));
2865template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2867typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2868unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_bucket_count() const
2871 return d_impl.maxNumBuckets();
2875template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2877float unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::load_factor() const
2880 return d_impl.loadFactor();
2883template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2885float unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_load_factor() const
2888 return d_impl.maxLoadFactor();
2894template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2900 return lhs.d_impl == rhs.d_impl;
2903#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
2904template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2910 return !(lhs == rhs);
2915template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR,
class PREDICATE>
2918bsl::erase_if(unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& ms,
2919 PREDICATE predicate)
2921 return BloombergLP::bslstl::AlgorithmUtil::containerEraseIf(ms, predicate);
2924template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2951template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2952struct HasStlIterators<
bsl::unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR> >
2960template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2961struct UsesBslmaAllocator<
bsl::unordered_multiset<KEY,
2973# error Not valid except when included from bslstl_unorderedmultiset.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_unorderedmultiset.h:770
void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2272
void reserve(size_type numElements)
Definition bslstl_unorderedmultiset.h:2441
size_type bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2560
const value_type & const_reference
Definition bslstl_unorderedmultiset.h:823
friend bool operator==(const unordered_multiset< KEY2, HASH2, EQUAL2, ALLOCATOR2 > &, const unordered_multiset< KEY2, HASH2, EQUAL2, ALLOCATOR2 > &)
::BloombergLP::bslstl::HashTableIterator< const value_type, difference_type > iterator
Definition bslstl_unorderedmultiset.h:831
KEY value_type
Definition bslstl_unorderedmultiset.h:818
AllocatorTraits::const_pointer const_pointer
Definition bslstl_unorderedmultiset.h:828
size_type bucket_size(size_type index) const
Definition bslstl_unorderedmultiset.h:2569
size_type bucket(const key_type &key) const
Definition bslstl_unorderedmultiset.h:2551
AllocatorTraits::difference_type difference_type
Definition bslstl_unorderedmultiset.h:826
size_type max_bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2678
iterator const_iterator
Definition bslstl_unorderedmultiset.h:836
local_iterator const_local_iterator
Definition bslstl_unorderedmultiset.h:837
EQUAL key_eq() const
Definition bslstl_unorderedmultiset.h:2655
HASH hash_function() const
Definition bslstl_unorderedmultiset.h:2647
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_unorderedmultiset.h:1203
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2244
size_type max_size() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2638
unordered_multiset &operator=(BloombergLP::bslmf::MovableRef< unordered_multiset > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2236
bool empty() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2620
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_unorderedmultiset.h:1140
size_type erase(const key_type &key)
Definition bslstl_unorderedmultiset.h:2309
iterator insert(const value_type &value)
Definition bslstl_unorderedmultiset.h:2359
AllocatorTraits::size_type size_type
Definition bslstl_unorderedmultiset.h:825
iterator emplace_hint(const_iterator hint, Args &&... args)
Definition bslstl_unorderedmultiset.h:2224
AllocatorTraits::pointer pointer
Definition bslstl_unorderedmultiset.h:827
void rehash(size_type numBuckets)
Definition bslstl_unorderedmultiset.h:2433
iterator emplace(Args &&... args)
Definition bslstl_unorderedmultiset.h:2213
bool contains(const key_type &key) const
Definition bslstl_unorderedmultiset.h:2610
float load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2687
value_type & reference
Definition bslstl_unorderedmultiset.h:822
float max_load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2695
HASH hasher
Definition bslstl_unorderedmultiset.h:819
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2499
::BloombergLP::bslstl::HashTableBucketIterator< const value_type, difference_type > local_iterator
Definition bslstl_unorderedmultiset.h:834
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this unordered multiset.
Definition bslstl_unorderedmultiset.h:2629
EQUAL key_equal
Definition bslstl_unorderedmultiset.h:820
ALLOCATOR allocator_type
Definition bslstl_unorderedmultiset.h:821
void swap(unordered_multiset &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits ALLOCATOR get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:1374
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_unorderedmultiset.h:1465
KEY key_type
Definition bslstl_unorderedmultiset.h:817
unordered_multiset()
Definition bslstl_unorderedmultiset.h:1942
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2490
#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