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);
189 const HASH& hashFunction = HASH(),
190 const EQUAL& keyEqual = EQUAL(),
191 const ALLOCATOR& basicAllocator = ALLOCATOR());
193 const HASH& hashFunction,
194 const ALLOCATOR& basicAllocator);
196 const ALLOCATOR& basicAllocator);
221 BloombergLP::bslmf::MovableRef<unordered_multiset> original);
236 const typename type_identity<ALLOCATOR>::type& basicAllocator);
254 BloombergLP::bslmf::MovableRef<unordered_multiset> original,
255 const typename type_identity<ALLOCATOR>::type& basicAllocator);
287 template <
class INPUT_ITERATOR>
291 const HASH& hashFunction = HASH(),
292 const EQUAL& keyEqual = EQUAL(),
293 const ALLOCATOR& basicAllocator = ALLOCATOR());
294 template <
class INPUT_ITERATOR>
298 const HASH& hashFunction,
299 const ALLOCATOR& basicAllocator);
300 template <
class INPUT_ITERATOR>
304 const ALLOCATOR& basicAllocator);
305 template <
class INPUT_ITERATOR>
308 const ALLOCATOR& basicAllocator);
310#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
311# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
313 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
314 class = bsl::enable_if_t<
315 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
316 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
320 std::initializer_list<KEY> values,
321 size_type initialNumBuckets = 0,
322 const HASH& hashFunction = HASH(),
323 const EQUAL& keyEqual = EQUAL(),
324 const ALLOCATOR& basicAllocator = ALLOCATOR());
325# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
327 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
328 class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>
332 size_type initialNumBuckets,
333 const HASH& hashFunction,
334 const ALLOCATOR& basicAllocator);
335# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
336 template <class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>>
339 size_type initialNumBuckets,
340 const ALLOCATOR& basicAllocator);
341# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
364 template <class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>>
367 const ALLOCATOR& basicAllocator);
394 template <class RANGE>
399 BSLS_COMPILERFEATURES_FORWARD_REF(RANGE) range,
400 size_type initialNumBuckets = 0,
401 const HASH& hashFunction = HASH(),
402 const EQUAL& keyEqual = EQUAL(),
403 const ALLOCATOR& basicAllocator = ALLOCATOR())
404 : d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
408#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
409&& defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
410 if constexpr (ranges::sized_range<RANGE>) {
411 insertFromRange(bsl::ranges::begin(range),
412 bsl::ranges::end (range),
413 bsl::ranges::size (range));
417 insertFromRange(bsl::ranges::begin(range),
418 bsl::ranges::end (range));
422 template <
class RANGE>
429 const HASH& hashFunction,
430 const ALLOCATOR& basicAllocator)
431 : d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
444 template <
class RANGE>
451 const ALLOCATOR& basicAllocator)
452 : d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
465 template <
class RANGE>
470 const ALLOCATOR& basicAllocator)
471 : d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
516 operator=(BloombergLP::bslmf::MovableRef<unordered_multiset>
rhs)
518 AllocatorTraits::is_always_equal::value
519 && std::is_nothrow_move_assignable<HASH>::value
520 && std::is_nothrow_move_assignable<EQUAL>::value);
522#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
572 template <class LOOKUP_KEY>
574 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
575 && BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
577 equal_range(const LOOKUP_KEY& key)
581 HashTableLink *first;
583 d_impl.findRange(&first, &last, key);
604 template <
class t_KEY>
606 BloombergLP::bslmf::IsTransparentPredicate<HASH, t_KEY>::value &&
607 BloombergLP::bslmf::IsTransparentPredicate<EQUAL,t_KEY>::value &&
622 }
while (it !=
end() &&
key_eq()(*it, key));
660 template <
class LOOKUP_KEY>
662 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
663 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
665 find(
const LOOKUP_KEY& key)
696 iterator insert(BloombergLP::bslmf::MovableRef<value_type> value);
733 BloombergLP::bslmf::MovableRef<value_type> value);
748 template <
class INPUT_ITERATOR>
749 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
751#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
757 void insert(std::initializer_list<KEY> values);
769 template <
class RANGE>
776#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
777&& defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
778 if constexpr (ranges::sized_range<RANGE>) {
779 insertFromRange(bsl::ranges::begin(range),
780 bsl::ranges::end (range),
781 bsl::ranges::size (range));
785 insertFromRange(bsl::ranges::begin(range),
786 bsl::ranges::end (range));
790#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
793#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
794#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT 10
796#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A
797#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
799#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 0
803#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 1
804 template <
class Args_01>
808#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 2
809 template <
class Args_01,
815#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 3
816 template <
class Args_01,
824#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 4
825 template <
class Args_01,
835#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 5
836 template <
class Args_01,
848#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 6
849 template <
class Args_01,
863#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 7
864 template <
class Args_01,
880#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 8
881 template <
class Args_01,
899#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 9
900 template <
class Args_01,
920#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 10
921 template <
class Args_01,
944#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 0
948#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 1
949 template <
class Args_01>
954#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 2
955 template <
class Args_01,
962#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 3
963 template <
class Args_01,
972#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 4
973 template <
class Args_01,
984#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 5
985 template <
class Args_01,
998#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 6
999 template <
class Args_01,
1014#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 7
1015 template <
class Args_01,
1032#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 8
1033 template <
class Args_01,
1052#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 9
1053 template <
class Args_01,
1074#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 10
1075 template <
class Args_01,
1101 template <
class... Args>
1104 template <
class... Args>
1151 AllocatorTraits::is_always_equal::value
1152 && bsl::is_nothrow_swappable<HASH>::value
1153 && bsl::is_nothrow_swappable<EQUAL>::value);
1160 template <
class INPUT_ITERATOR,
class SENTINEL>
1161 void constructFromRange(INPUT_ITERATOR first, SENTINEL last);
1163#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1164 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1172 template <
class INPUT_ITERATOR,
class SENTINEL>
1173 void constructFromRange(INPUT_ITERATOR first,
1175 size_t numElements);
1180 template <
class INPUT_ITERATOR,
class SENTINEL>
1181 void insertFromRange(INPUT_ITERATOR first, SENTINEL last);
1183#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1184 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1192 template <
class INPUT_ITERATOR,
class SENTINEL>
1193 void insertFromRange(INPUT_ITERATOR first,
1195 size_t numElements);
1226 template <class LOOKUP_KEY>
1228 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value &&
1229 BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,
1232 contains(const LOOKUP_KEY& key)
const
1270 template <class LOOKUP_KEY>
1272 BloombergLP::
bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1273 && BloombergLP::
bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1275 find(const LOOKUP_KEY& key)
const
1292 template <
class LOOKUP_KEY>
1294 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1295 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1297 count(
const LOOKUP_KEY& key)
const
1300 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
1303 for (HashTableLink *cursor = d_impl.find(key);
1305 ++result, cursor = cursor->nextLink()) {
1307 BNode *cursorNode =
static_cast<BNode *
>(cursor);
1310 ListConfiguration::extractKey(cursorNode->value()))) {
1331 template <
class LOOKUP_KEY>
1333 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1334 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1335 pair<const_iterator, const_iterator> >::type
1340 HashTableLink *first;
1341 HashTableLink *last;
1342 d_impl.findRange(&first, &last, key);
1387 template <
class LOOKUP_KEY>
1389 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1390 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1392 bucket(
const LOOKUP_KEY& key)
const
1394 return d_impl.bucketIndexForKey(key);
1431#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1442 class INPUT_ITERATOR,
1443 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1447 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY&>>,
1448 class = bsl::enable_if_t<
1449 std::is_invocable_v<EQUAL, const KEY&, const KEY&>>,
1450 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1454 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1457 ALLOCATOR = ALLOCATOR())
1466 class INPUT_ITERATOR,
1467 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1471 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1472 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1477 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1490 class INPUT_ITERATOR,
1491 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1494 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1495 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1499 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1510 class INPUT_ITERATOR,
1511 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1514 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1515 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1520 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1530 class INPUT_ITERATOR,
1532 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1533 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1537 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1546 class INPUT_ITERATOR,
1547 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1549 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1550 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1555 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1564 class INPUT_ITERATOR,
1566 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1567 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1577 class INPUT_ITERATOR,
1578 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1580 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1581 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1595 class HASH = bsl::hash<KEY>,
1596 class EQUAL = bsl::equal_to<KEY>,
1597 class ALLOCATOR = bsl::allocator<KEY>,
1598 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY&>>,
1599 class = bsl::enable_if_t<
1600 std::is_invocable_v<EQUAL, const KEY&, const KEY&>>,
1601 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1604 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1607 ALLOCATOR = ALLOCATOR())
1621 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1622 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1625 std::initializer_list<KEY>,
1626 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1642 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1643 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1646 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1660 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1661 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1664 std::initializer_list<KEY>,
1665 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1677 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1680 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1691 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1692 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1695 std::initializer_list<KEY>,
1696 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1707 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1719 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1720 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1736template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1737bool operator==(const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& lhs,
1738 const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& rhs);
1740#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
1741template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1742bool operator!=(const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& lhs,
1743 const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& rhs);
1758template <class KEY, class HASH, class EQUAL, class ALLOCATOR, class PREDICATE>
1760erase_if(unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& ms,
1761 PREDICATE predicate);
1763template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1764void
swap(unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& a,
1765 unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& b)
1767 BSLS_KEYWORD_NOEXCEPT_OPERATOR(a.swap(b)));
1790template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1791template <class INPUT_ITERATOR, class SENTINEL>
1794 INPUT_ITERATOR first,
1804 if (first == last) {
1809 BloombergLP::bslstl::IteratorUtil::
1810 canCalculateInsertDistance<INPUT_ITERATOR,SENTINEL>()) {
1812 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
1815 while (first != last) {
1816 d_impl.insert(*first);
1821#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1822 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1824template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1825template <
class INPUT_ITERATOR,
class SENTINEL>
1827void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::constructFromRange(
1828 INPUT_ITERATOR first,
1833 !BloombergLP::bslstl::IteratorUtil
1834 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()
1835 || numElements ==
static_cast<size_t>(
1836 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last))));
1838 if (0 < numElements) {
1842 while (first != last) {
1843 d_impl.insert(*first);
1850template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1851template <
class INPUT_ITERATOR,
class SENTINEL>
1853void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insertFromRange(
1854 INPUT_ITERATOR first,
1865 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()) {
1867 + BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
1870 while (first != last) {
1871 d_impl.insert(*first);
1876#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1877 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1879template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1880template <
class INPUT_ITERATOR,
class SENTINEL>
1882void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insertFromRange(
1883 INPUT_ITERATOR first,
1888 !BloombergLP::bslstl::IteratorUtil
1889 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()
1890 || numElements ==
static_cast<size_t>(
1891 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last))));
1895 while (first != last) {
1896 d_impl.insert(*first);
1904template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1907: d_impl(HASH(), EQUAL(), 0, 1.0f, ALLOCATOR())
1911template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1913unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1914 size_type initialNumBuckets,
1915 const HASH& hashFunction,
1916 const EQUAL& keyEqual,
1917 const ALLOCATOR& basicAllocator)
1918: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1922template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1924unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1925 size_type initialNumBuckets,
1926 const HASH& hashFunction,
1927 const ALLOCATOR& basicAllocator)
1928: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1932template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1934unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1935 size_type initialNumBuckets,
1936 const ALLOCATOR& basicAllocator)
1937: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1941template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1943unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1944 const ALLOCATOR& basicAllocator)
1945: d_impl(basicAllocator)
1949template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1951unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1952 const unordered_multiset& original)
1953: d_impl(original.d_impl,
1954 AllocatorTraits::select_on_container_copy_construction(
1955 original.get_allocator()))
1959template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1961unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1962 BloombergLP::bslmf::MovableRef<unordered_multiset> original)
1963: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl))
1967template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1969unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1970 const unordered_multiset& original,
1971 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1972: d_impl(original.d_impl, basicAllocator)
1976template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1978unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1979 BloombergLP::bslmf::MovableRef<unordered_multiset> original,
1980 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1981: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl), basicAllocator)
1985template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
1986template <
class INPUT_ITERATOR>
1988unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1989 INPUT_ITERATOR first,
1990 INPUT_ITERATOR last,
1991 size_type initialNumBuckets,
1992 const HASH& hashFunction,
1993 const EQUAL& keyEqual,
1994 const ALLOCATOR& basicAllocator)
1995: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1997 constructFromRange(first, last);
2000template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2001template <
class INPUT_ITERATOR>
2003unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2004 INPUT_ITERATOR first,
2005 INPUT_ITERATOR last,
2006 size_type initialNumBuckets,
2007 const HASH& hashFunction,
2008 const ALLOCATOR& basicAllocator)
2009: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
2011 this->insert(first, last);
2014template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2015template <
class INPUT_ITERATOR>
2017unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2018 INPUT_ITERATOR first,
2019 INPUT_ITERATOR last,
2020 size_type initialNumBuckets,
2021 const ALLOCATOR& basicAllocator)
2022: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
2024 this->insert(first, last);
2027template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2028template <
class INPUT_ITERATOR>
2030unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2031 INPUT_ITERATOR first,
2032 INPUT_ITERATOR last,
2033 const ALLOCATOR& basicAllocator)
2034: d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
2036 this->insert(first, last);
2039#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2040template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2041#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2042template <
class,
class,
class>
2045unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2046 std::initializer_list<KEY> values,
2047 size_type initialNumBuckets,
2048 const hasher& hashFunction,
2049 const key_equal& keyEqual,
2050 const ALLOCATOR& basicAllocator)
2051: unordered_multiset(values.
begin(),
2060template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2061#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2062template <
class,
class>
2065unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2066 std::initializer_list<KEY> values,
2067 size_type initialNumBuckets,
2068 const HASH& hashFunction,
2069 const ALLOCATOR& basicAllocator)
2070: unordered_multiset(values.
begin(),
2079template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2080#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2084unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2085 std::initializer_list<KEY> values,
2086 size_type initialNumBuckets,
2087 const ALLOCATOR& basicAllocator)
2088: unordered_multiset(values.
begin(),
2097template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2098#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2102unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2103 std::initializer_list<KEY> values,
2104 const ALLOCATOR& basicAllocator)
2105: unordered_multiset(values.
begin(),
2115template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2117unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::~unordered_multiset()
2123template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2125unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>&
2126unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
2127 const unordered_multiset& rhs)
2132 d_impl =
rhs.d_impl;
2137template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2139unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>&
2140unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
2141 BloombergLP::bslmf::MovableRef<unordered_multiset> rhs)
2143 AllocatorTraits::is_always_equal::value
2144 && std::is_nothrow_move_assignable<HASH>::value
2145 && std::is_nothrow_move_assignable<EQUAL>::value)
2150 unordered_multiset& lvalue =
rhs;
2152 d_impl = MoveUtil::move(lvalue.d_impl);
2157#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2158template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2160unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>&
2161unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
2162 std::initializer_list<KEY> values)
2164 unordered_multiset tmp(values, d_impl.allocator());
2166 d_impl.swap(tmp.d_impl);
2172#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2175#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
2176#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT 10
2178#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B
2179#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
2181#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 0
2182template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2184typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2185unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2188 return iterator(d_impl.emplace(
2194#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 1
2195template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2196template <
class Args_01>
2198typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2199unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2202 return iterator(d_impl.emplace(
2208#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 2
2209template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2210template <
class Args_01,
2213typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2214unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2218 return iterator(d_impl.emplace(
2225#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 3
2226template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2227template <
class Args_01,
2231typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2232unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2237 return iterator(d_impl.emplace(
2245#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 4
2246template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2247template <
class Args_01,
2252typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2253unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2259 return iterator(d_impl.emplace(
2268#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 5
2269template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2270template <
class Args_01,
2276typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2277unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2284 return iterator(d_impl.emplace(
2294#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 6
2295template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2296template <
class Args_01,
2303typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2304unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2312 return iterator(d_impl.emplace(
2323#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 7
2324template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2325template <
class Args_01,
2333typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2334unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2343 return iterator(d_impl.emplace(
2355#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 8
2356template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2357template <
class Args_01,
2366typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2367unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2377 return iterator(d_impl.emplace(
2390#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 9
2391template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2392template <
class Args_01,
2402typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2403unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2414 return iterator(d_impl.emplace(
2428#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 10
2429template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2430template <
class Args_01,
2441typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2442unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2454 return iterator(d_impl.emplace(
2470#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 0
2471template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2473typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2474unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2475 const_iterator hint)
2477 return iterator(d_impl.emplaceWithHint(hint.node()));
2481#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 1
2482template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2483template <
class Args_01>
2485typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2486unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2487 const_iterator hint,
2490 return iterator(d_impl.emplaceWithHint(hint.node(),
2495#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 2
2496template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2497template <
class Args_01,
2500typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2501unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2502 const_iterator hint,
2506 return iterator(d_impl.emplaceWithHint(hint.node(),
2512#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 3
2513template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2514template <
class Args_01,
2518typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2519unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2520 const_iterator hint,
2525 return iterator(d_impl.emplaceWithHint(hint.node(),
2532#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 4
2533template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2534template <
class Args_01,
2539typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2540unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2541 const_iterator hint,
2547 return iterator(d_impl.emplaceWithHint(hint.node(),
2555#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 5
2556template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2557template <
class Args_01,
2563typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2564unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2565 const_iterator hint,
2572 return iterator(d_impl.emplaceWithHint(hint.node(),
2581#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 6
2582template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2583template <
class Args_01,
2590typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2591unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2592 const_iterator hint,
2600 return iterator(d_impl.emplaceWithHint(hint.node(),
2610#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 7
2611template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2612template <
class Args_01,
2620typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2621unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2622 const_iterator hint,
2631 return iterator(d_impl.emplaceWithHint(hint.node(),
2642#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 8
2643template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2644template <
class Args_01,
2653typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2654unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2655 const_iterator hint,
2665 return iterator(d_impl.emplaceWithHint(hint.node(),
2677#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 9
2678template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2679template <
class Args_01,
2689typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2690unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2691 const_iterator hint,
2702 return iterator(d_impl.emplaceWithHint(hint.node(),
2715#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 10
2716template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2717template <
class Args_01,
2728typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2729unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2730 const_iterator hint,
2742 return iterator(d_impl.emplaceWithHint(hint.node(),
2759template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2760template <
class... Args>
2762typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2763unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2766 return iterator(d_impl.emplace(
2771template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2772template <
class... Args>
2774typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2775unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2776 const_iterator hint,
2779 return iterator(d_impl.emplaceWithHint(hint.node(),
2785template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2787typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2790 return iterator(d_impl.elementListRoot());
2793template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2795typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2801template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2803typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::local_iterator
2804unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::begin(size_type index)
2808 return local_iterator(&d_impl.bucketAtIndex(index));
2811template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2813typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::local_iterator
2814unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::end(size_type index)
2818 return local_iterator(0, &d_impl.bucketAtIndex(index));
2821template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2829template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2830typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2831unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::find(
const key_type& key)
2833 return iterator(d_impl.find(key));
2836template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2839 typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator>
2840unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::equal_range(
2841 const key_type& key)
2843 HashTableLink *first;
2844 HashTableLink *last;
2845 d_impl.findRange(&first, &last, key);
2849template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2851typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2852unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::erase(const_iterator position)
2856 return iterator(d_impl.remove(position.node()));
2859template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2860typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2861unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::erase(
const key_type& key)
2863 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
2865 HashTableLink *target = d_impl.find(key);
2867 target = d_impl.remove(target);
2868 size_type result = 1;
2870 this->key_eq()(key, ListConfiguration::extractKey(
2871 static_cast<BNode *
>(target)->value()))) {
2872 target = d_impl.remove(target);
2881template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2882typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2883unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::erase(const_iterator first,
2884 const_iterator last)
2887#if defined BDE_BUILD_TARGET_SAFE_2
2888 if (first != last) {
2889 iterator it = this->
begin();
2890 const iterator
end = this->end();
2891 for (; it != first; ++it) {
2895 for (; it != last; ++it) {
2901 while (first != last) {
2902 first = this->
erase(first);
2905 return iterator(first.node());
2908template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2910typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2911unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2912 const value_type& value)
2914 return iterator(d_impl.insert(value));
2917template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2919typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2920unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2921 BloombergLP::bslmf::MovableRef<value_type> value)
2923 return iterator(d_impl.insert(MoveUtil::move(value)));
2926template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2928typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2929unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2930 const_iterator hint,
2931 const value_type& value)
2933 return iterator(d_impl.insert(value, hint.node()));
2936template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2938typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2939unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2940 const_iterator hint,
2941 BloombergLP::bslmf::MovableRef<value_type> value)
2943 return iterator(d_impl.insert(MoveUtil::move(value), hint.node()));
2946template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2947template <
class INPUT_ITERATOR>
2949unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(INPUT_ITERATOR first,
2950 INPUT_ITERATOR last)
2952 insertFromRange(first, last);
2955#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2956template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2958void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2959 std::initializer_list<KEY> values)
2961 insert(values.begin(), values.end());
2965template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2967void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_load_factor(
2968 float newLoadFactor)
2970 d_impl.setMaxLoadFactor(newLoadFactor);
2973template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2976unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::rehash(size_type numBuckets)
2978 d_impl.rehashForNumBuckets(numBuckets);
2981template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2984unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::reserve(size_type numElements)
2986 d_impl.reserveForNumElements(numElements);
2989template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
2992unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::swap(
2993 unordered_multiset& other)
2995 AllocatorTraits::is_always_equal::value
2996 && bsl::is_nothrow_swappable<HASH>::value
2997 && bsl::is_nothrow_swappable<EQUAL>::value)
2999 d_impl.swap(other.d_impl);
3003template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3006unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::get_allocator() const
3009 return d_impl.allocator();
3012template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3014typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
3015unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::begin() const
3018 return const_iterator(d_impl.elementListRoot());
3021template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3023typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
3024unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::end() const
3027 return const_iterator();
3030template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3032typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
3033unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cbegin() const
3036 return const_iterator(d_impl.elementListRoot());
3039template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3041typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
3042unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cend() const
3045 return const_iterator();
3048template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3050typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
3051unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::begin(size_type index)
const
3055 return const_local_iterator(&d_impl.bucketAtIndex(index));
3058template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3061 unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
3062unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::end(size_type index)
const
3066 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
3069template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3072 unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
3073unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cbegin(size_type index)
const
3077 return const_local_iterator(&d_impl.bucketAtIndex(index));
3080template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3082typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
3083unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cend(size_type index)
const
3087 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
3090template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3092typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3093unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::bucket(
3094 const key_type& key)
const
3096 return d_impl.bucketIndexForKey(key);
3099template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3101typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3102unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::bucket_count() const
3105 return d_impl.numBuckets();
3108template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3110typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3111unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::bucket_size(
3112 size_type index)
const
3116 return d_impl.countElementsInBucket(index);
3119template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3120typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3121unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::count(
3122 const key_type& key)
const
3124 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
3126 size_type result = 0;
3127 for (HashTableLink *cursor = d_impl.find(key);
3129 ++result, cursor = cursor->nextLink()) {
3131 BNode *cursorNode =
static_cast<BNode *
>(cursor);
3132 if (!this->key_eq()(
3134 ListConfiguration::extractKey(cursorNode->value()))) {
3141template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3143typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
3144unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::find(
3145 const key_type& key)
const
3147 return const_iterator(d_impl.find(key));
3150template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3152bool unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::contains(
3153 const key_type& key)
const
3155 return find(key) !=
end();
3158template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3161unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::empty() const
3164 return 0 == d_impl.size();
3167template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3169typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3170unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size() const
3173 return d_impl.size();
3176template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3178typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3179unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_size() const
3182 return AllocatorTraits::max_size(get_allocator());
3185template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3187typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::hasher
3188unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::hash_function()
const
3190 return d_impl.hasher();
3193template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3195typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::key_equal
3196unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::key_eq()
const
3198 return d_impl.comparator();
3201template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3204 typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator,
3205 typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator>
3206unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::equal_range(
3207 const key_type& key)
const
3209 HashTableLink *first;
3210 HashTableLink *last;
3211 d_impl.findRange(&first, &last, key);
3213 const_iterator(last));
3216template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3218typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3219unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_bucket_count() const
3222 return d_impl.maxNumBuckets();
3225template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3227float unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::load_factor() const
3230 return d_impl.loadFactor();
3233template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3235float unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_load_factor() const
3238 return d_impl.maxLoadFactor();
3244template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3250 return lhs.d_impl ==
rhs.d_impl;
3253#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
3254template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3265template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR,
class PREDICATE>
3268bsl::erase_if(unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& ms,
3269 PREDICATE predicate)
3271 return BloombergLP::bslstl::AlgorithmUtil::containerEraseIf(ms, predicate);
3274template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3301template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3302struct HasStlIterators<
bsl::unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR> >
3310template <
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
3311struct UsesBslmaAllocator<
bsl::unordered_multiset<KEY,
3323# 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:588
Definition bslstl_pair.h:1280
Definition bslstl_unorderedmultiset.h:801
void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2666
void reserve(size_type numElements)
Definition bslstl_unorderedmultiset.h:2826
size_type bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2944
const value_type & const_reference
Definition bslstl_unorderedmultiset.h:854
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:862
KEY value_type
Definition bslstl_unorderedmultiset.h:849
AllocatorTraits::const_pointer const_pointer
Definition bslstl_unorderedmultiset.h:859
size_type bucket_size(size_type index) const
Definition bslstl_unorderedmultiset.h:2953
size_type bucket(const key_type &key) const
Definition bslstl_unorderedmultiset.h:2935
AllocatorTraits::difference_type difference_type
Definition bslstl_unorderedmultiset.h:857
size_type max_bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:3061
iterator const_iterator
Definition bslstl_unorderedmultiset.h:867
local_iterator const_local_iterator
Definition bslstl_unorderedmultiset.h:868
EQUAL key_eq() const
Definition bslstl_unorderedmultiset.h:3038
HASH hash_function() const
Definition bslstl_unorderedmultiset.h:3030
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:1380
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2638
size_type max_size() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:3021
unordered_multiset &operator=(BloombergLP::bslmf::MovableRef< unordered_multiset > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2630
bool empty() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:3003
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:1292
size_type erase(const key_type &key)
Definition bslstl_unorderedmultiset.h:2703
iterator insert(const value_type &value)
Definition bslstl_unorderedmultiset.h:2753
AllocatorTraits::size_type size_type
Definition bslstl_unorderedmultiset.h:856
iterator emplace_hint(const_iterator hint, Args &&... args)
Definition bslstl_unorderedmultiset.h:2618
AllocatorTraits::pointer pointer
Definition bslstl_unorderedmultiset.h:858
void rehash(size_type numBuckets)
Definition bslstl_unorderedmultiset.h:2818
iterator emplace(Args &&... args)
Definition bslstl_unorderedmultiset.h:2607
unordered_multiset & operator=(const unordered_multiset &rhs)
Definition bslstl_unorderedmultiset.h:2556
bool contains(const key_type &key) const
Definition bslstl_unorderedmultiset.h:2994
float load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:3069
value_type & reference
Definition bslstl_unorderedmultiset.h:853
float max_load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:3077
HASH hasher
Definition bslstl_unorderedmultiset.h:850
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2884
::BloombergLP::bslstl::HashTableBucketIterator< const value_type, difference_type > local_iterator
Definition bslstl_unorderedmultiset.h:865
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this unordered multiset.
Definition bslstl_unorderedmultiset.h:3012
EQUAL key_equal
Definition bslstl_unorderedmultiset.h:851
~unordered_multiset()
Destroy this object.
Definition bslstl_unorderedmultiset.h:2547
ALLOCATOR allocator_type
Definition bslstl_unorderedmultiset.h:852
ALLOCATOR get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2848
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:1727
KEY key_type
Definition bslstl_unorderedmultiset.h:848
unordered_multiset()
Definition bslstl_unorderedmultiset.h:2336
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2875
#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_CONSTEXPR_CPP17
Definition bsls_keyword.h:639
#define BSLS_KEYWORD_NOEXCEPT_OPERATOR(...)
Definition bsls_keyword.h:677
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:676
#define BSLSTL_UNORDEREDMULTISET_REQUIRES_CONTAINER_COMPATIBLE_RANGE(R, T)
Definition bslstl_unorderedmultiset.h:764
void swap(OptionValue &a, OptionValue &b)
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)
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