11#ifndef INCLUDED_BSLSTL_UNORDEREDMULTIMAP_CPP03
12#define INCLUDED_BSLSTL_UNORDEREDMULTIMAP_CPP03
63#ifdef COMPILING_BSLSTL_UNORDEREDMULTIMAP_H
86class unordered_multimap {
97 typedef pair<const KEY, VALUE> ValueType;
102 typedef ::BloombergLP::bslstl::UnorderedMapKeyConfiguration<
const KEY,
109 typedef ::BloombergLP::bslstl::HashTable<ListConfiguration,
116 typedef ::BloombergLP::bslalg::BidirectionalLink HashTableLink;
120 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
123 template <
class KEY2,
129 const unordered_multimap<KEY2, VALUE2, HASH2, EQUAL2, ALLOCATOR2>&,
130 const unordered_multimap<KEY2, VALUE2, HASH2, EQUAL2, ALLOCATOR2>&);
149 typedef ::BloombergLP::bslstl::HashTableIterator<
152 typedef ::BloombergLP::bslstl::HashTableIterator<
155 typedef ::BloombergLP::bslstl::HashTableBucketIterator<
158 typedef ::BloombergLP::bslstl::HashTableBucketIterator<
188 const HASH& hashFunction = HASH(),
189 const EQUAL& keyEqual = EQUAL(),
190 const ALLOCATOR& basicAllocator = ALLOCATOR());
192 const HASH& hashFunction,
193 const ALLOCATOR& basicAllocator);
195 const ALLOCATOR& basicAllocator);
220 BloombergLP::bslmf::MovableRef<unordered_multimap> original);
236 const typename type_identity<ALLOCATOR>::type& basicAllocator);
255 BloombergLP::bslmf::MovableRef<unordered_multimap> original,
256 const typename type_identity<ALLOCATOR>::type& basicAllocator);
290 template <
class INPUT_ITERATOR>
294 const HASH& hashFunction = HASH(),
295 const EQUAL& keyEqual = EQUAL(),
296 const ALLOCATOR& basicAllocator = ALLOCATOR());
297 template <
class INPUT_ITERATOR>
301 const HASH& hashFunction,
302 const ALLOCATOR& basicAllocator);
303 template <
class INPUT_ITERATOR>
307 const ALLOCATOR& basicAllocator);
308 template <
class INPUT_ITERATOR>
311 const ALLOCATOR& basicAllocator);
313#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
314# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
316 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
317 class = bsl::enable_if_t<
318 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
319 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
323 std::initializer_list<value_type> values,
324 size_type initialNumBuckets = 0,
325 const HASH& hashFunction = HASH(),
326 const EQUAL& keyEqual = EQUAL(),
327 const ALLOCATOR& basicAllocator = ALLOCATOR());
328# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
330 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
331 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
335 size_type initialNumBuckets,
336 const HASH& hashFunction,
337 const ALLOCATOR& basicAllocator);
338# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
340 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
344 size_type initialNumBuckets,
345 const ALLOCATOR& basicAllocator);
346# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
372 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
376 const ALLOCATOR& basicAllocator);
403 template <class RANGE>
408 BSLS_COMPILERFEATURES_FORWARD_REF(RANGE) range,
409 size_type initialNumBuckets = 0,
410 const HASH& hashFunction = HASH(),
411 const EQUAL& keyEqual = EQUAL(),
412 const ALLOCATOR& basicAllocator = ALLOCATOR())
413 : d_impl(hashFunction,
420#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
421 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
422 if constexpr (ranges::sized_range<RANGE>) {
423 constructFromRange(bsl::ranges::begin(range),
424 bsl::ranges::end (range),
425 bsl::ranges::size (range));
429 constructFromRange(bsl::ranges::begin(range),
430 bsl::ranges::end (range));
434 template <
class RANGE>
440 const HASH& hashFunction,
441 const ALLOCATOR& basicAllocator)
442 : d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
455 template <
class RANGE>
461 const ALLOCATOR& basicAllocator)
462 : d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
475 template <
class RANGE>
480 const ALLOCATOR& basicAllocator)
481 : d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
527 operator=(BloombergLP::bslmf::MovableRef<unordered_multimap>
rhs)
529 AllocatorTraits::is_always_equal::value &&
530 std::is_nothrow_move_assignable<HASH>::value &&
531 std::is_nothrow_move_assignable<EQUAL>::value);
533#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
589 template <class LOOKUP_KEY>
591 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
592 && BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
594 equal_range(const LOOKUP_KEY& key)
598 HashTableLink *first;
600 d_impl.findRange(&first, &last, key);
622 template <
class t_KEY>
624 BloombergLP::bslmf::IsTransparentPredicate<HASH, t_KEY>::value &&
625 BloombergLP::bslmf::IsTransparentPredicate<EQUAL,t_KEY>::value &&
640 }
while (it !=
end() &&
key_eq()(it->first, key));
680 template <
class LOOKUP_KEY>
682 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
683 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
685 find(
const LOOKUP_KEY& key)
705#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
706 template <
class ALT_VALUE_TYPE>
708#elif !defined(BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER)
709 template <
class ALT_VALUE_TYPE>
710 typename enable_if<is_convertible<ALT_VALUE_TYPE, value_type>::value,
720 template <
class ALT_VALUE_TYPE>
721 typename enable_if<std::is_constructible<
value_type,
722 ALT_VALUE_TYPE&&>::value,
749#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
750 template <
class ALT_VALUE_TYPE>
752#elif !defined(BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER)
753 template <
class ALT_VALUE_TYPE>
754 typename enable_if<is_convertible<ALT_VALUE_TYPE, value_type>::value,
773 template <
class ALT_VALUE_TYPE>
774 typename enable_if<std::is_constructible<
value_type,
775 ALT_VALUE_TYPE&&>::value,
801 template <
class INPUT_ITERATOR>
802 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
809 template <
class RANGE>
815#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
816 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
817 if constexpr (ranges::sized_range<RANGE>) {
818 insertFromRange(bsl::ranges::begin(range),
819 bsl::ranges::end (range),
820 bsl::ranges::size (range));
824 insertFromRange(bsl::ranges::begin(range),
825 bsl::ranges::end (range));
829#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
835 void insert(std::initializer_list<value_type> values);
838#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
841#ifndef BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT
842#define BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT 2
844#ifndef BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A
845#define BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT
848#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 0
852#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 1
853 template <
class Args_1>
857#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 2
858 template <
class Args_1,
865#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 0
869#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 1
870 template <
class Args_1>
875#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 2
876 template <
class Args_1,
887 template <
class... Args>
890 template <
class... Args>
935 AllocatorTraits::is_always_equal::value &&
936 bsl::is_nothrow_swappable<HASH>::value &&
937 bsl::is_nothrow_swappable<EQUAL>::value);
966 template <class LOOKUP_KEY>
968 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value &&
969 BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,
972 contains(const LOOKUP_KEY& key)
const
1010 template <class LOOKUP_KEY>
1012 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1013 && BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1015 find(const LOOKUP_KEY& key)
const
1032 template <
class LOOKUP_KEY>
1034 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1035 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1037 count(
const LOOKUP_KEY& key)
const
1040 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
1043 for (HashTableLink *cursor = d_impl.find(key);
1045 ++result, cursor = cursor->nextLink())
1047 BNode *cursorNode =
static_cast<BNode *
>(cursor);
1050 ListConfiguration::extractKey(cursorNode->value()))) {
1073 template <
class LOOKUP_KEY>
1075 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1076 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1077 pair<const_iterator, const_iterator> >::type
1082 HashTableLink *first;
1083 HashTableLink *last;
1084 d_impl.findRange(&first, &last, key);
1129 template <
class LOOKUP_KEY>
1131 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1132 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1134 bucket(
const LOOKUP_KEY& key)
const
1136 return d_impl.bucketIndexForKey(key);
1181 template <class INPUT_ITERATOR, class SENTINEL>
1182 void constructFromRange(INPUT_ITERATOR first, SENTINEL last);
1184#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1185 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1186 template <
class INPUT_ITERATOR,
class SENTINEL>
1187 void constructFromRange(INPUT_ITERATOR first,
1189 size_t numElements);
1197 template <
class INPUT_ITERATOR,
class SENTINEL>
1198 void insertFromRange(INPUT_ITERATOR first, SENTINEL last);
1200#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1201 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1202 template <
class INPUT_ITERATOR,
class SENTINEL>
1203 void insertFromRange(INPUT_ITERATOR first,
1205 size_t numElements);
1209#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1219 class INPUT_ITERATOR,
1220 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1222 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1226 class = bsl::enable_if_t<
std::is_invocable_v<HASH, const KEY &>>,
1227 class = bsl::enable_if_t<
1228 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
1229 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1231unordered_multimap(INPUT_ITERATOR,
1233 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1236 ALLOCATOR = ALLOCATOR())
1237-> unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>;
1246 class INPUT_ITERATOR,
1250 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1252 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1253 class DEFAULT_ALLOCATOR = bsl::allocator<pair<const KEY, VALUE>>,
1254 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1259 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1263-> unordered_multimap<KEY, VALUE, HASH, EQUAL>;
1273 class INPUT_ITERATOR,
1276 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1278 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1279 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1280 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1282unordered_multimap(INPUT_ITERATOR,
1284 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1287-> unordered_multimap<KEY, VALUE, HASH, bsl::equal_to<KEY>, ALLOCATOR>;
1296 class INPUT_ITERATOR,
1299 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1301 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1302 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1303 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1308 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1311-> unordered_multimap<KEY, VALUE, HASH>;
1318 class INPUT_ITERATOR,
1320 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1322 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1323 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1325unordered_multimap(INPUT_ITERATOR,
1327 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1329-> unordered_multimap<KEY,
1341 class INPUT_ITERATOR,
1343 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1345 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1346 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1347 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1352 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1354-> unordered_multimap<KEY, VALUE>;
1363 class INPUT_ITERATOR,
1365 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1367 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1368 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1370unordered_multimap(INPUT_ITERATOR, INPUT_ITERATOR, ALLOCATOR)
1371-> unordered_multimap<KEY,
1382 class INPUT_ITERATOR,
1384 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1386 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1387 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1388 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1390unordered_multimap(INPUT_ITERATOR, INPUT_ITERATOR, ALLOC *)
1391-> unordered_multimap<KEY, VALUE>;
1404 class HASH = bsl::hash<KEY>,
1405 class EQUAL = bsl::equal_to<KEY>,
1406 class ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1407 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1408 class = bsl::enable_if_t<
1409 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
1410 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1412unordered_multimap(std::initializer_list<bsl::pair<const KEY, VALUE>>,
1413 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1416 ALLOCATOR = ALLOCATOR())
1417-> unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>;
1432 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1433 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1436 std::initializer_list<bsl::pair<const KEY, VALUE>>,
1437 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1441-> unordered_multimap<KEY, VALUE, HASH, EQUAL>;
1455 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1456 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1458unordered_multimap(std::initializer_list<bsl::pair<const KEY, VALUE>>,
1459 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1462-> unordered_multimap<KEY, VALUE, HASH, bsl::equal_to<KEY>, ALLOCATOR>;
1475 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1476 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1479 std::initializer_list<bsl::pair<const KEY, VALUE>>,
1480 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1483-> unordered_multimap<KEY, VALUE, HASH>;
1493 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1495unordered_multimap(std::initializer_list<bsl::pair<const KEY, VALUE>>,
1496 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1498-> unordered_multimap<KEY,
1513 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1514 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1517 std::initializer_list<bsl::pair<const KEY, VALUE>>,
1518 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1520-> unordered_multimap<KEY, VALUE>;
1532 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1534unordered_multimap(std::initializer_list<bsl::pair<const KEY, VALUE>>,
1536-> unordered_multimap<KEY,
1551 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1552 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1554unordered_multimap(std::initializer_list<bsl::pair<const KEY, VALUE>>, ALLOC *)
1555-> unordered_multimap<KEY, VALUE>;
1567template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1569 const unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& lhs,
1570 const unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& rhs);
1572#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
1573template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1575 const unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& lhs,
1576 const unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& rhs);
1597typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
1598erase_if(unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& m,
1599 PREDICATE predicate);
1614template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1615void
swap(unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& a,
1616 unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& b)
1629template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1630template <class INPUT_ITERATOR, class SENTINEL>
1631void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
1632 constructFromRange(INPUT_ITERATOR first,
1637 const difference_type maxInsertions =
1638 ::BloombergLP::bslstl::IteratorUtil::insertDistance(first, last);
1639 if (0 < maxInsertions) {
1646 while (first != last) {
1647 d_impl.emplace(*first);
1652#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1653 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1654template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1655template <
class INPUT_ITERATOR,
class SENTINEL>
1656void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
1657 constructFromRange(INPUT_ITERATOR first,
1663 if (0 < numElements) {
1667 while (first != last) {
1668 d_impl.emplace(*first);
1674template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1675template <
class INPUT_ITERATOR,
class SENTINEL>
1676void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
1677 insertFromRange(INPUT_ITERATOR first,
1680 const difference_type maxInsertions =
1681 ::BloombergLP::bslstl::IteratorUtil::insertDistance(first, last);
1682 if (0 < maxInsertions) {
1689 while (first != last) {
1690 d_impl.emplace(*first);
1695#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1696 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1697template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1698template <
class INPUT_ITERATOR,
class SENTINEL>
1699void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
1700 insertFromRange(INPUT_ITERATOR first,
1704 if (0 < numElements) {
1708 while (first != last) {
1709 d_impl.emplace(*first);
1716template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1719: d_impl(HASH(), EQUAL(), 0, 1.0f, ALLOCATOR())
1723template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1725unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1726 size_type initialNumBuckets,
1727 const HASH& hashFunction,
1728 const EQUAL& keyEqual,
1729 const ALLOCATOR& basicAllocator)
1730: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1734template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1736unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1737 size_type initialNumBuckets,
1738 const HASH& hashFunction,
1739 const ALLOCATOR& basicAllocator)
1740: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1744template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1746unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1747 size_type initialNumBuckets,
1748 const ALLOCATOR& basicAllocator)
1749: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1753template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1755unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1756 const ALLOCATOR& basicAllocator)
1757: d_impl(basicAllocator)
1761template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1763unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1764 const unordered_multimap& original)
1765: d_impl(original.d_impl,
1766 AllocatorTraits::select_on_container_copy_construction(
1767 original.get_allocator()))
1771template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1773unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1774 BloombergLP::bslmf::MovableRef<unordered_multimap> original)
1775: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl))
1779template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1781unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1782 const unordered_multimap& original,
1783 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1784: d_impl(original.d_impl, basicAllocator)
1788template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1790unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1791 BloombergLP::bslmf::MovableRef<unordered_multimap> original,
1792 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1793: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl), basicAllocator)
1797template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1798template <
class INPUT_ITERATOR>
1800unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1801 INPUT_ITERATOR first,
1802 INPUT_ITERATOR last,
1803 size_type initialNumBuckets,
1804 const HASH& hashFunction,
1805 const EQUAL& keyEqual,
1806 const ALLOCATOR& basicAllocator)
1807: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1809 constructFromRange(first, last);
1812template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1813template <
class INPUT_ITERATOR>
1815unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1816 INPUT_ITERATOR first,
1817 INPUT_ITERATOR last,
1818 size_type initialNumBuckets,
1819 const HASH& hashFunction,
1820 const ALLOCATOR& basicAllocator)
1821: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1823 this->insert(first, last);
1826template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1827template <
class INPUT_ITERATOR>
1829unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1830 INPUT_ITERATOR first,
1831 INPUT_ITERATOR last,
1832 size_type initialNumBuckets,
1833 const ALLOCATOR& basicAllocator)
1834: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1836 this->insert(first, last);
1839template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1840template <
class INPUT_ITERATOR>
1842unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1843 INPUT_ITERATOR first,
1844 INPUT_ITERATOR last,
1845 const ALLOCATOR& basicAllocator)
1846: d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
1848 this->insert(first, last);
1851#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1852template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1853# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1854template <
class,
class,
class>
1857unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1858 std::initializer_list<value_type> values,
1859 size_type initialNumBuckets,
1860 const HASH& hashFunction,
1861 const EQUAL& keyEqual,
1862 const ALLOCATOR& basicAllocator)
1863: unordered_multimap(values.
begin(),
1872template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1873# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1874template <
class,
class>
1877unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1878 std::initializer_list<value_type> values,
1879 size_type initialNumBuckets,
1880 const HASH& hashFunction,
1881 const ALLOCATOR& basicAllocator)
1882: unordered_multimap(values.
begin(),
1891template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1892# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1896unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1897 std::initializer_list<value_type> values,
1898 size_type initialNumBuckets,
1899 const ALLOCATOR& basicAllocator)
1900: unordered_multimap(values.
begin(),
1909template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1910# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1914unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1915 std::initializer_list<value_type> values,
1916 const ALLOCATOR& basicAllocator)
1917: unordered_multimap(values.
begin(),
1927template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1928unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::~unordered_multimap()
1934template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1935unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>&
1936unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::operator=(
1937 const unordered_multimap& rhs)
1942 d_impl =
rhs.d_impl;
1947template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1949unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>&
1950unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::operator=(
1951 BloombergLP::bslmf::MovableRef<unordered_multimap> rhs)
1953 AllocatorTraits::is_always_equal::value &&
1954 std::is_nothrow_move_assignable<HASH>::value &&
1955 std::is_nothrow_move_assignable<EQUAL>::value)
1960 unordered_multimap& lvalue =
rhs;
1962 d_impl = MoveUtil::move(lvalue.d_impl);
1967#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1968template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1970unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>&
1971unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::operator=(
1972 std::initializer_list<value_type> values)
1974 unordered_multimap tmp(values.begin(), values.end(), d_impl.allocator());
1976 d_impl.swap(tmp.d_impl);
1982#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1985#ifndef BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT
1986#define BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT 2
1988#ifndef BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B
1989#define BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT
1991#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 0
1992template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
1994typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
1995unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace(
1998 return iterator(d_impl.emplace(
2004#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 1
2005template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2006template <
class Args_1>
2008typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2009unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace(
2012 return iterator(d_impl.emplace(
2018#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 2
2019template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2020template <
class Args_1,
2023typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2024unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace(
2028 return iterator(d_impl.emplace(
2036#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 0
2037template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2039typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2040unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2041 const_iterator hint)
2043 return iterator(d_impl.emplaceWithHint(hint.node()));
2047#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 1
2048template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2049template <
class Args_1>
2051typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2052unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2053 const_iterator hint,
2056 return iterator(d_impl.emplaceWithHint(hint.node(),
2061#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 2
2062template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2063template <
class Args_1,
2066typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2067unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2068 const_iterator hint,
2072 return iterator(d_impl.emplaceWithHint(hint.node(),
2081template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2082template <
class... Args>
2084typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2085unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace(
2088 return iterator(d_impl.emplace(
2093template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2094template <
class... Args>
2096typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2097unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2098 const_iterator hint,
2101 return iterator(d_impl.emplaceWithHint(hint.node(),
2107template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2109typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2110unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::begin()
2113 return iterator(d_impl.elementListRoot());
2116template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2118typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2119unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::end()
2125template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2127typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::local_iterator
2128unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::begin(size_type index)
2132 return local_iterator(&d_impl.bucketAtIndex(index));
2135template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2137typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::local_iterator
2138unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::end(size_type index)
2142 return local_iterator(0, &d_impl.bucketAtIndex(index));
2145template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2147void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::clear()
2153template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2155bool unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::contains(
2156 const key_type& key)
const
2158 return find(key) !=
end();
2161template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2163typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2164unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::find(
2165 const key_type& key)
2167 return iterator(d_impl.find(key));
2170template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2172 typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator,
2173 typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator>
2174unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::equal_range(
2175 const key_type& key)
2177 HashTableLink *first;
2178 HashTableLink *last;
2179 d_impl.findRange(&first, &last, key);
2183template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2185typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2186unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::erase(
2187 const_iterator position)
2191 return iterator(d_impl.remove(position.node()));
2194template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2196typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2197unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::erase(
2200 return erase(const_iterator(position));
2203template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2204typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2205unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::erase(
2206 const key_type& key)
2212 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
2214 if (HashTableLink *target = d_impl.find(key)) {
2215 target = d_impl.remove(target);
2216 size_type result = 1;
2218 this->key_eq()(key, ListConfiguration::extractKey(
2219 static_cast<BNode *
>(target)->value()))) {
2220 target = d_impl.remove(target);
2229template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2230typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2231unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::erase(
2232 const_iterator first,
2233 const_iterator last)
2235#if defined BDE_BUILD_TARGET_SAFE_2
2236 if (first != last) {
2237 iterator it = this->
begin();
2238 const iterator
end = this->end();
2239 for (; it != first; ++it) {
2243 for (; it != last; ++it) {
2249 while (first != last) {
2250 first = this->
erase(first);
2253 return iterator(first.node());
2256template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2258typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2259unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::insert(
2260 const value_type& value)
2262 return iterator(d_impl.insert(value));
2265template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2267typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2268unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::insert(
2269 const_iterator hint,
2270 const value_type& value)
2272 return iterator(d_impl.insert(value, hint.node()));
2275template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2276template <
class INPUT_ITERATOR>
2277void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::insert(
2278 INPUT_ITERATOR first,
2279 INPUT_ITERATOR last)
2281 insertFromRange(first, last);
2284#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2285template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2287void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::insert(
2288 std::initializer_list<value_type> values)
2290 insert(values.begin(), values.end());
2294template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2296void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::max_load_factor(
2297 float newLoadFactor)
2299 d_impl.setMaxLoadFactor(newLoadFactor);
2302template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2304void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::rehash(
2305 size_type numBuckets)
2307 d_impl.rehashForNumBuckets(numBuckets);
2310template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2312void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::reserve(
2313 size_type numElements)
2315 d_impl.reserveForNumElements(numElements);
2318template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2320void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::swap(
2321 unordered_multimap& other)
2323 AllocatorTraits::is_always_equal::value &&
2324 bsl::is_nothrow_swappable<HASH>::value &&
2325 bsl::is_nothrow_swappable<EQUAL>::value)
2327 d_impl.swap(other.d_impl);
2331template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2334unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::get_allocator() const
2337 return d_impl.allocator();
2340template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2341typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_iterator
2342unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::begin() const
2345 return const_iterator(d_impl.elementListRoot());
2348template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2350typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_iterator
2351unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::end() const
2354 return const_iterator();
2357template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2358typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_iterator
2359unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::cbegin() const
2362 return const_iterator(d_impl.elementListRoot());
2365template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2367typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_iterator
2368unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::cend() const
2371 return const_iterator();
2374template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2376typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
2377 const_local_iterator
2378unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::begin(
2379 size_type index)
const
2383 return const_local_iterator(&d_impl.bucketAtIndex(index));
2386template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2389unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2390unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::end(
2391 size_type index)
const
2395 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
2398template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2401unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2402unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::cbegin(
2403 size_type index)
const
2407 return const_local_iterator(&d_impl.bucketAtIndex(index));
2410template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2412typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
2413 const_local_iterator
2414unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::cend(
2415 size_type index)
const
2419 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
2422template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2424typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2425unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::bucket(
2426 const key_type& key)
const
2428 return d_impl.bucketIndexForKey(key);
2431template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2433typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2434unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::bucket_count() const
2437 return d_impl.numBuckets();
2440template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2442typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2443unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::bucket_size(
2444 size_type index)
const
2448 return d_impl.countElementsInBucket(index);
2451template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2452typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>:: size_type
2453unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::count(
2454 const key_type& key)
const
2456 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
2458 size_type result = 0;
2459 for (HashTableLink *cursor = d_impl.find(key);
2461 ++result, cursor = cursor->nextLink())
2463 BNode *cursorNode =
static_cast<BNode *
>(cursor);
2464 if (!this->key_eq()(key,
2465 ListConfiguration::extractKey(cursorNode->value()))) {
2473template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2475typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_iterator
2476unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::find(
2477 const key_type& key)
const
2479 return const_iterator(d_impl.find(key));
2482template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2484bool unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::empty() const
2487 return 0 == d_impl.size();
2490template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2492typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2493unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size() const
2496 return d_impl.size();
2499template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2501typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2502unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::max_size() const
2505 return AllocatorTraits::max_size(get_allocator());
2508template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2510typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::hasher
2511unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::hash_function()
const
2513 return d_impl.hasher();
2516template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2518typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::key_equal
2519unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::key_eq()
const
2521 return d_impl.comparator();
2524template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2525bsl::pair<
typename unordered_multimap<KEY,
2529 ALLOCATOR>::const_iterator,
2530 typename unordered_multimap<KEY,
2534 ALLOCATOR>::const_iterator>
2535unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::equal_range(
2536 const key_type& key)
const
2538 HashTableLink *first;
2539 HashTableLink *last;
2540 d_impl.findRange(&first, &last, key);
2542 const_iterator(last));
2545template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2547typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2548unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>:: max_bucket_count()
2552 return d_impl.maxNumBuckets();
2555template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2557float unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::load_factor()
2561 return d_impl.loadFactor();
2564template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2566float unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::max_load_factor()
2570 return d_impl.maxLoadFactor();
2576template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2582 return lhs.d_impl ==
rhs.d_impl;
2585#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
2586template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2605bsl::erase_if(unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& m,
2606 PREDICATE predicate)
2608 return BloombergLP::bslstl::AlgorithmUtil::containerEraseIf(m, predicate);
2611template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2636template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2637struct HasStlIterators<
bsl::unordered_multimap<KEY,
2649template <
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
2650struct UsesBslmaAllocator<
bsl::unordered_multimap<KEY,
2662template <
class KEY,
class MAPPED,
class HASH,
class EQUAL,
class ALLOCATOR>
2663struct IsBitwiseMoveable<
2664 bsl::unordered_multimap<KEY, MAPPED, HASH, EQUAL, ALLOCATOR> >
2665 : ::BloombergLP::bslmf::IsBitwiseMoveable<BloombergLP::bslstl::HashTable<
2666 ::BloombergLP::bslstl::
2667 UnorderedMapKeyConfiguration<KEY, bsl::pair<const KEY, MAPPED> >,
2677# error Not valid except when included from bslstl_unorderedmultimap.h
Definition bslma_bslallocator.h:588
Definition bslstl_pair.h:1280
Definition bslstl_unorderedmultimap.h:740
float max_load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:3096
friend bool operator==(const unordered_multimap< KEY2, VALUE2, HASH2, EQUAL2, ALLOCATOR2 > &, const unordered_multimap< KEY2, VALUE2, HASH2, EQUAL2, ALLOCATOR2 > &)
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_unorderedmultimap.h:1248
unordered_multimap()
Definition bslstl_unorderedmultimap.h:2348
bool empty() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:3014
const value_type & const_reference
Definition bslstl_unorderedmultimap.h:796
EQUAL key_eq() const
Definition bslstl_unorderedmultimap.h:3049
float load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:3087
KEY key_type
Definition bslstl_unorderedmultimap.h:788
ALLOCATOR allocator_type
Definition bslstl_unorderedmultimap.h:793
AllocatorTraits::const_pointer const_pointer
Definition bslstl_unorderedmultimap.h:801
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2649
size_type max_size() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:3032
void reserve(size_type numElements)
Definition bslstl_unorderedmultimap.h:2842
HASH hash_function() const
Definition bslstl_unorderedmultimap.h:3041
::BloombergLP::bslstl::HashTableIterator< value_type, difference_type > iterator
Definition bslstl_unorderedmultimap.h:804
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_unorderedmultimap.h:1339
unordered_multimap &operator=(BloombergLP::bslmf::MovableRef< unordered_multimap > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2640
size_type bucket(const key_type &key) const
Definition bslstl_unorderedmultimap.h:2955
value_type & reference
Definition bslstl_unorderedmultimap.h:795
HASH hasher
Definition bslstl_unorderedmultimap.h:791
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2889
void swap(unordered_multimap &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:1573
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2898
unordered_multimap & operator=(const unordered_multimap &rhs)
Definition bslstl_unorderedmultimap.h:2566
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_unorderedmultimap.h:1667
::BloombergLP::bslstl::HashTableIterator< const value_type, difference_type > const_iterator
Definition bslstl_unorderedmultimap.h:807
EQUAL key_equal
Definition bslstl_unorderedmultimap.h:792
size_type max_bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:3078
size_type bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2964
iterator insert(const value_type &value)
Definition bslstl_unorderedmultimap.h:2789
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this unordered multimap.
Definition bslstl_unorderedmultimap.h:3023
size_type erase(const key_type &key)
Definition bslstl_unorderedmultimap.h:2735
bool contains(const key_type &key) const
Definition bslstl_unorderedmultimap.h:2685
::BloombergLP::bslstl::HashTableBucketIterator< const value_type, difference_type > const_local_iterator
Definition bslstl_unorderedmultimap.h:813
AllocatorTraits::difference_type difference_type
Definition bslstl_unorderedmultimap.h:799
iterator emplace_hint(const_iterator hint, Args &&... args)
Definition bslstl_unorderedmultimap.h:2628
::BloombergLP::bslstl::HashTableBucketIterator< value_type, difference_type > local_iterator
Definition bslstl_unorderedmultimap.h:810
AllocatorTraits::pointer pointer
Definition bslstl_unorderedmultimap.h:800
bsl::pair< const KEY, VALUE > value_type
Definition bslstl_unorderedmultimap.h:790
AllocatorTraits::size_type size_type
Definition bslstl_unorderedmultimap.h:798
void rehash(size_type numBuckets)
Definition bslstl_unorderedmultimap.h:2834
iterator emplace(Args &&... args)
Definition bslstl_unorderedmultimap.h:2617
size_type bucket_size(size_type index) const
Definition bslstl_unorderedmultimap.h:2973
void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2677
~unordered_multimap()
Destroy this object.
Definition bslstl_unorderedmultimap.h:2558
VALUE mapped_type
Definition bslstl_unorderedmultimap.h:789
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:676
#define BSLSTL_UNORDEREDMULTIMAP_REQUIRES_CONTAINER_COMPATIBLE_RANGE(R, T)
Definition bslstl_unorderedmultimap.h:703
void swap(OptionValue &a, OptionValue &b)
bsl::size_t size(const TYPE &array)
Return the number of elements in the specified array.
int reserve(TYPE *array, int numElements)
Definition bdlat_valuetypefunctions.h:939
void swap(array< VALUE_TYPE, SIZE > &lhs, array< VALUE_TYPE, SIZE > &rhs)
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
deque< VALUE_TYPE, ALLOCATOR >::size_type erase(deque< VALUE_TYPE, ALLOCATOR > &deq, const BDE_OTHER_TYPE &value)
Definition bslstl_deque.h:4424
T::iterator begin(T &container)
Definition bslstl_iterator.h:1593
const from_range_t from_range
bool operator==(const memory_resource &a, const memory_resource &b)
ALLOCATOR & lhs
Definition bslstl_string.h:3917
T::iterator end(T &container)
Definition bslstl_iterator.h:1621
deque< VALUE_TYPE, ALLOCATOR >::size_type erase_if(deque< VALUE_TYPE, ALLOCATOR > &deq, PREDICATE predicate)
Definition bslstl_deque.h:4433
bool operator!=(const memory_resource &a, const memory_resource &b)
BSLS_KEYWORD_CONSTEXPR bool empty(const CONTAINER &container)
Definition bslstl_iterator.h:1377
Definition bdlc_flathashmap.h:2218
Definition baljsn_encoder_testtypes.h:76
Definition bdlbb_blob.h:579
Definition bdldfp_decimal.h:5549
Definition bslma_allocatortraits.h:1089
BloombergLP::bslma::AllocatorTraits_ConstPointerType< ALLOCATOR >::type const_pointer
Definition bslma_allocatortraits.h:1183
BloombergLP::bslma::AllocatorTraits_SizeType< ALLOCATOR >::type size_type
Definition bslma_allocatortraits.h:1196
BloombergLP::bslma::AllocatorTraits_PointerType< ALLOCATOR >::type pointer
Definition bslma_allocatortraits.h:1180
BloombergLP::bslma::AllocatorTraits_DifferenceType< ALLOCATOR >::type difference_type
Definition bslma_allocatortraits.h:1193
Definition bslstl_equalto.h:316
Definition bslstl_ranges.h:301
Definition bslstl_hash.h:495
Definition bslmf_isconvertible.h:875