11#ifndef INCLUDED_BSLSTL_HASHTABLE_CPP03
12#define INCLUDED_BSLSTL_HASHTABLE_CPP03
63#ifdef COMPILING_BSLSTL_HASHTABLE_H
69template <
class KEY_CONFIG,
75template <
class FACTORY>
76class HashTable_ArrayProctor;
78template <
class FACTORY>
79class HashTable_NodeProctor;
81template <
class FUNCTOR>
82class HashTable_ComparatorWrapper;
84template <
class FUNCTOR>
85class HashTable_ComparatorWrapper<const FUNCTOR>;
87template <
class FUNCTOR>
88class HashTable_ComparatorWrapper<FUNCTOR &>;
90template <
class FUNCTOR>
91class HashTable_HashWrapper;
93template <
class FUNCTOR>
94class HashTable_HashWrapper<const FUNCTOR>;
96template <
class FUNCTOR>
97class HashTable_HashWrapper<FUNCTOR &>;
99struct HashTable_ImpDetails;
100struct HashTable_Util;
116template <
class CALLABLE>
117struct CallableVariable {
143template <
class FUNCTOR>
144class HashTable_HashWrapper {
147 mutable FUNCTOR d_functor;
171 template <
class ARG_TYPE>
176 const FUNCTOR&
functor()
const;
188template <
class FUNCTOR>
189class HashTable_HashWrapper<const FUNCTOR> {
192 const FUNCTOR d_functor;
211 template <
class ARG_TYPE>
216 const FUNCTOR&
functor()
const;
229template <
class FUNCTOR>
230class HashTable_HashWrapper<FUNCTOR &> {
240 explicit HashTable_HashWrapper(FUNCTOR& fn);
248 template <
class ARG_TYPE>
249 std::size_t operator()(ARG_TYPE& arg)
const;
253 FUNCTOR& functor()
const;
258template <
class FUNCTOR>
259void swap(HashTable_HashWrapper<FUNCTOR> &a,
260 HashTable_HashWrapper<FUNCTOR> &b);
274template <
class FUNCTOR>
275class HashTable_ComparatorWrapper {
278 mutable FUNCTOR d_functor;
302 template <
class ARG1_TYPE,
class ARG2_TYPE>
303 bool operator()(ARG1_TYPE& arg1, ARG2_TYPE& arg2)
const;
307 const FUNCTOR&
functor()
const;
319template <
class FUNCTOR>
320class HashTable_ComparatorWrapper<const FUNCTOR> {
323 const FUNCTOR d_functor;
342 template <
class ARG1_TYPE,
class ARG2_TYPE>
343 bool operator()(ARG1_TYPE& arg1, ARG2_TYPE& arg2)
const;
347 const FUNCTOR&
functor()
const;
360template <
class FUNCTOR>
361class HashTable_ComparatorWrapper<FUNCTOR &> {
371 explicit HashTable_ComparatorWrapper(FUNCTOR& fn);
379 template <
class ARG1_TYPE,
class ARG2_TYPE>
380 bool operator()(ARG1_TYPE& arg1, ARG2_TYPE& arg2)
const;
384 FUNCTOR& functor()
const;
389template <
class FUNCTOR>
390void swap(HashTable_ComparatorWrapper<FUNCTOR> &lhs,
391 HashTable_ComparatorWrapper<FUNCTOR> &rhs);
397template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
398class HashTable_ImplParameters;
445template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
452 typedef typename KEY_CONFIG::KeyType
KeyType;
453 typedef typename KEY_CONFIG::ValueType
ValueType;
455 typedef typename AllocatorTraits::size_type
SizeType;
461 HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>
474 typedef typename AllocatorTraits::template rebind_traits<NodeType>
478 ReboundTraits::propagate_on_container_copy_assignment::value ==
479 AllocatorTraits::propagate_on_container_copy_assignment::value);
482 ReboundTraits::propagate_on_container_move_assignment::value ==
483 AllocatorTraits::propagate_on_container_move_assignment::value);
485 BSLMF_ASSERT(ReboundTraits::propagate_on_container_swap::value ==
486 AllocatorTraits::propagate_on_container_swap::value);
490 ImplParameters d_parameters;
497 float d_maxLoadFactor;
535 void quickSwapExchangeAllocators(HashTable *other);
542 void quickSwapRetainAllocators(HashTable *other);
558 void rehashIntoExactlyNumBuckets(
SizeType newNumBuckets,
567 void removeAllAndDeallocate();
591 template <
class DEDUCED_KEY>
593 std::size_t hashValue)
const;
625 explicit HashTable(
const ALLOCATOR& basicAllocator = ALLOCATOR());
648 const COMPARATOR& compare,
650 float initialMaxLoadFactor,
651 const ALLOCATOR& basicAllocator = ALLOCATOR());
678 HashTable(BloombergLP::bslmf::MovableRef<HashTable> original);
691 HashTable(
const HashTable& original,
const ALLOCATOR& basicAllocator);
710 HashTable(BloombergLP::bslmf::MovableRef<HashTable> original,
711 const ALLOCATOR& basicAllocator);
751#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
754#ifndef BSLSTL_HASHTABLE_VARIADIC_LIMIT
755#define BSLSTL_HASHTABLE_VARIADIC_LIMIT 10
757#ifndef BSLSTL_HASHTABLE_VARIADIC_LIMIT_A
758#define BSLSTL_HASHTABLE_VARIADIC_LIMIT_A BSLSTL_HASHTABLE_VARIADIC_LIMIT
760#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 0
765#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 1
766 template <
class Args_01>
771#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 2
772 template <
class Args_01,
779#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 3
780 template <
class Args_01,
789#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 4
790 template <
class Args_01,
801#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 5
802 template <
class Args_01,
815#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 6
816 template <
class Args_01,
831#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 7
832 template <
class Args_01,
849#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 8
850 template <
class Args_01,
869#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 9
870 template <
class Args_01,
891#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 10
892 template <
class Args_01,
916#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 0
921#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 1
922 template <
class Args_01>
928#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 2
929 template <
class Args_01,
937#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 3
938 template <
class Args_01,
948#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 4
949 template <
class Args_01,
961#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 5
962 template <
class Args_01,
976#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 6
977 template <
class Args_01,
993#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 7
994 template <
class Args_01,
1012#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 8
1013 template <
class Args_01,
1033#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 9
1034 template <
class Args_01,
1056#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 10
1057 template <
class Args_01,
1082#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 0
1086#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 1
1087 template <
class Args_01>
1092#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 2
1093 template <
class Args_01,
1100#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 3
1101 template <
class Args_01,
1110#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 4
1111 template <
class Args_01,
1122#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 5
1123 template <
class Args_01,
1136#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 6
1137 template <
class Args_01,
1152#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 7
1153 template <
class Args_01,
1170#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 8
1171 template <
class Args_01,
1190#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 9
1191 template <
class Args_01,
1212#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_A >= 10
1213 template <
class Args_01,
1239 template <
class... Args>
1243 template <
class... Args>
1248 template <
class... Args>
1290 bool *isInsertedFlag,
1309 bool *isInsertedFlag,
1330 template <
class SOURCE_TYPE>
1333 bool *isInsertedFlag,
1339 template <
class LOOKUP_KEY>
1341 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
1342 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value
1345 bool *isInsertedFlag,
1351 const LOOKUP_KEY& lvalue = value;
1353 size_t hashCode = this->d_parameters.hashCodeForTransparentKey(lvalue);
1356 bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
1359 d_parameters.comparator(),
1362 *isInsertedFlag = (!position);
1365 if (d_size >= d_capacity) {
1369 position = d_parameters.nodeFactory().emplaceIntoNewNode(
1398 template <
class SOURCE_TYPE>
1423 template <
class SOURCE_TYPE>
1431 template <
class KEY_ARG,
class BDE_OTHER_TYPE>
1433 bool *isInsertedFlag,
1438 template <
class LOOKUP_KEY,
class BDE_OTHER_TYPE>
1440 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
1441 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value
1451 size_t hashCode = this->d_parameters.hashCodeForTransparentKey(key);
1453 || !d_parameters.comparator()(key,
1454 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
1455 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
1458 d_parameters.comparator(),
1463 static_cast<NodeType *
>(hint)->value().second =
1465 *isInsertedFlag =
false;
1469 if (d_size >= d_capacity) {
1473 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
1477 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
1478 nodeProctor(&d_parameters.nodeFactory(), hint);
1479 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
1480 nodeProctor.release();
1483 *isInsertedFlag =
true;
1560 void swap(HashTable& other);
1562#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1565#ifndef BSLSTL_HASHTABLE_VARIADIC_LIMIT
1566#define BSLSTL_HASHTABLE_VARIADIC_LIMIT 10
1568#ifndef BSLSTL_HASHTABLE_VARIADIC_LIMIT_D
1569#define BSLSTL_HASHTABLE_VARIADIC_LIMIT_D BSLSTL_HASHTABLE_VARIADIC_LIMIT
1571#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 0
1573 bool *isInsertedFlag,
1578#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 1
1579 template <
class ARGS_01>
1581 bool *isInsertedFlag,
1587#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 2
1588 template <
class ARGS_01,
1591 bool *isInsertedFlag,
1598#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 3
1599 template <
class ARGS_01,
1603 bool *isInsertedFlag,
1611#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 4
1612 template <
class ARGS_01,
1617 bool *isInsertedFlag,
1626#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 5
1627 template <
class ARGS_01,
1633 bool *isInsertedFlag,
1643#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 6
1644 template <
class ARGS_01,
1651 bool *isInsertedFlag,
1662#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 7
1663 template <
class ARGS_01,
1671 bool *isInsertedFlag,
1683#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 8
1684 template <
class ARGS_01,
1693 bool *isInsertedFlag,
1706#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 9
1707 template <
class ARGS_01,
1717 bool *isInsertedFlag,
1731#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 10
1732 template <
class ARGS_01,
1743 bool *isInsertedFlag,
1759#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 0
1761 bool *isInsertedFlag,
1766#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 1
1767 template <
class ARGS_01>
1769 bool *isInsertedFlag,
1775#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 2
1776 template <
class ARGS_01,
1779 bool *isInsertedFlag,
1786#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 3
1787 template <
class ARGS_01,
1791 bool *isInsertedFlag,
1799#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 4
1800 template <
class ARGS_01,
1805 bool *isInsertedFlag,
1814#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 5
1815 template <
class ARGS_01,
1821 bool *isInsertedFlag,
1831#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 6
1832 template <
class ARGS_01,
1839 bool *isInsertedFlag,
1850#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 7
1851 template <
class ARGS_01,
1859 bool *isInsertedFlag,
1871#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 8
1872 template <
class ARGS_01,
1881 bool *isInsertedFlag,
1894#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 9
1895 template <
class ARGS_01,
1905 bool *isInsertedFlag,
1919#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 10
1920 template <
class ARGS_01,
1931 bool *isInsertedFlag,
1948#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 0
1949 template <
class LOOKUP_KEY>
1951 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
1952 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
1954 bool *isInsertedFlag,
1961 const std::size_t hashCode =
1962 this->d_parameters.hashCodeForTransparentKey(key);
1965 || !d_parameters.comparator()(
1967 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
1969 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
1972 d_parameters.comparator(),
1977 *isInsertedFlag =
false;
1981 if (d_size >= d_capacity) {
1985 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
1986 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
1987 std::piecewise_construct,
1989 std::forward_as_tuple());
1991 typedef typename ValueType::second_type MappedType;
1997 AllocatorTraits::construct(alloc, defaultMapped.
address());
2000 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2005 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2006 nodeProctor(&d_parameters.nodeFactory(), hint);
2007 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2008 nodeProctor.release();
2011 *isInsertedFlag =
true;
2016#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 1
2017 template <
class LOOKUP_KEY,
class ARGS_01>
2019 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2020 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2022 bool *isInsertedFlag,
2030 const std::size_t hashCode =
2031 this->d_parameters.hashCodeForTransparentKey(key);
2034 || !d_parameters.comparator()(
2036 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2038 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2041 d_parameters.comparator(),
2046 *isInsertedFlag =
false;
2050 if (d_size >= d_capacity) {
2054 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2055 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2056 std::piecewise_construct,
2058 std::forward_as_tuple(
2061 typedef typename ValueType::second_type MappedType;
2067 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2071 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2076 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2077 nodeProctor(&d_parameters.nodeFactory(), hint);
2078 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2079 nodeProctor.release();
2082 *isInsertedFlag =
true;
2087#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 2
2088 template <
class LOOKUP_KEY,
class ARGS_01,
2091 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2092 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2094 bool *isInsertedFlag,
2103 const std::size_t hashCode =
2104 this->d_parameters.hashCodeForTransparentKey(key);
2107 || !d_parameters.comparator()(
2109 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2111 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2114 d_parameters.comparator(),
2119 *isInsertedFlag =
false;
2123 if (d_size >= d_capacity) {
2127 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2128 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2129 std::piecewise_construct,
2131 std::forward_as_tuple(
2135 typedef typename ValueType::second_type MappedType;
2141 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2146 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2151 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2152 nodeProctor(&d_parameters.nodeFactory(), hint);
2153 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2154 nodeProctor.release();
2157 *isInsertedFlag =
true;
2162#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 3
2163 template <
class LOOKUP_KEY,
class ARGS_01,
2167 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2168 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2170 bool *isInsertedFlag,
2180 const std::size_t hashCode =
2181 this->d_parameters.hashCodeForTransparentKey(key);
2184 || !d_parameters.comparator()(
2186 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2188 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2191 d_parameters.comparator(),
2196 *isInsertedFlag =
false;
2200 if (d_size >= d_capacity) {
2204 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2205 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2206 std::piecewise_construct,
2208 std::forward_as_tuple(
2213 typedef typename ValueType::second_type MappedType;
2219 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2225 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2230 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2231 nodeProctor(&d_parameters.nodeFactory(), hint);
2232 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2233 nodeProctor.release();
2236 *isInsertedFlag =
true;
2241#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 4
2242 template <
class LOOKUP_KEY,
class ARGS_01,
2247 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2248 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2250 bool *isInsertedFlag,
2261 const std::size_t hashCode =
2262 this->d_parameters.hashCodeForTransparentKey(key);
2265 || !d_parameters.comparator()(
2267 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2269 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2272 d_parameters.comparator(),
2277 *isInsertedFlag =
false;
2281 if (d_size >= d_capacity) {
2285 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2286 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2287 std::piecewise_construct,
2289 std::forward_as_tuple(
2295 typedef typename ValueType::second_type MappedType;
2301 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2308 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2313 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2314 nodeProctor(&d_parameters.nodeFactory(), hint);
2315 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2316 nodeProctor.release();
2319 *isInsertedFlag =
true;
2324#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 5
2325 template <
class LOOKUP_KEY,
class ARGS_01,
2331 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2332 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2334 bool *isInsertedFlag,
2346 const std::size_t hashCode =
2347 this->d_parameters.hashCodeForTransparentKey(key);
2350 || !d_parameters.comparator()(
2352 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2354 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2357 d_parameters.comparator(),
2362 *isInsertedFlag =
false;
2366 if (d_size >= d_capacity) {
2370 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2371 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2372 std::piecewise_construct,
2374 std::forward_as_tuple(
2381 typedef typename ValueType::second_type MappedType;
2387 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2395 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2400 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2401 nodeProctor(&d_parameters.nodeFactory(), hint);
2402 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2403 nodeProctor.release();
2406 *isInsertedFlag =
true;
2411#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 6
2412 template <
class LOOKUP_KEY,
class ARGS_01,
2419 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2420 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2422 bool *isInsertedFlag,
2435 const std::size_t hashCode =
2436 this->d_parameters.hashCodeForTransparentKey(key);
2439 || !d_parameters.comparator()(
2441 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2443 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2446 d_parameters.comparator(),
2451 *isInsertedFlag =
false;
2455 if (d_size >= d_capacity) {
2459 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2460 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2461 std::piecewise_construct,
2463 std::forward_as_tuple(
2471 typedef typename ValueType::second_type MappedType;
2477 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2486 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2491 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2492 nodeProctor(&d_parameters.nodeFactory(), hint);
2493 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2494 nodeProctor.release();
2497 *isInsertedFlag =
true;
2502#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 7
2503 template <
class LOOKUP_KEY,
class ARGS_01,
2511 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2512 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2514 bool *isInsertedFlag,
2528 const std::size_t hashCode =
2529 this->d_parameters.hashCodeForTransparentKey(key);
2532 || !d_parameters.comparator()(
2534 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2536 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2539 d_parameters.comparator(),
2544 *isInsertedFlag =
false;
2548 if (d_size >= d_capacity) {
2552 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2553 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2554 std::piecewise_construct,
2556 std::forward_as_tuple(
2565 typedef typename ValueType::second_type MappedType;
2571 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2581 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2586 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2587 nodeProctor(&d_parameters.nodeFactory(), hint);
2588 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2589 nodeProctor.release();
2592 *isInsertedFlag =
true;
2597#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 8
2598 template <
class LOOKUP_KEY,
class ARGS_01,
2607 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2608 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2610 bool *isInsertedFlag,
2625 const std::size_t hashCode =
2626 this->d_parameters.hashCodeForTransparentKey(key);
2629 || !d_parameters.comparator()(
2631 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2633 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2636 d_parameters.comparator(),
2641 *isInsertedFlag =
false;
2645 if (d_size >= d_capacity) {
2649 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2650 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2651 std::piecewise_construct,
2653 std::forward_as_tuple(
2663 typedef typename ValueType::second_type MappedType;
2669 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2680 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2685 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2686 nodeProctor(&d_parameters.nodeFactory(), hint);
2687 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2688 nodeProctor.release();
2691 *isInsertedFlag =
true;
2696#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 9
2697 template <
class LOOKUP_KEY,
class ARGS_01,
2707 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2708 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2710 bool *isInsertedFlag,
2726 const std::size_t hashCode =
2727 this->d_parameters.hashCodeForTransparentKey(key);
2730 || !d_parameters.comparator()(
2732 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2734 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2737 d_parameters.comparator(),
2742 *isInsertedFlag =
false;
2746 if (d_size >= d_capacity) {
2750 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2751 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2752 std::piecewise_construct,
2754 std::forward_as_tuple(
2765 typedef typename ValueType::second_type MappedType;
2771 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2783 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2788 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2789 nodeProctor(&d_parameters.nodeFactory(), hint);
2790 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2791 nodeProctor.release();
2794 *isInsertedFlag =
true;
2799#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_D >= 10
2800 template <
class LOOKUP_KEY,
class ARGS_01,
2811 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2812 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2814 bool *isInsertedFlag,
2831 const std::size_t hashCode =
2832 this->d_parameters.hashCodeForTransparentKey(key);
2835 || !d_parameters.comparator()(
2837 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2839 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2842 d_parameters.comparator(),
2847 *isInsertedFlag =
false;
2851 if (d_size >= d_capacity) {
2855 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2856 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2857 std::piecewise_construct,
2859 std::forward_as_tuple(
2871 typedef typename ValueType::second_type MappedType;
2877 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2890 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2895 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2896 nodeProctor(&d_parameters.nodeFactory(), hint);
2897 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2898 nodeProctor.release();
2901 *isInsertedFlag =
true;
2909 template <
class... ARGS>
2911 bool *isInsertedFlag,
2916 template <
class... ARGS>
2918 bool *isInsertedFlag,
2924 template <
class LOOKUP_KEY,
class... ARGS>
2926 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2927 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2929 bool *isInsertedFlag,
2937 const std::size_t hashCode =
2938 this->d_parameters.hashCodeForTransparentKey(key);
2941 || !d_parameters.comparator()(
2943 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2945 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2948 d_parameters.comparator(),
2953 *isInsertedFlag =
false;
2957 if (d_size >= d_capacity) {
2961 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2962 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2963 std::piecewise_construct,
2967 typedef typename ValueType::second_type MappedType;
2973 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2977 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2982 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
2983 nodeProctor(&d_parameters.nodeFactory(), hint);
2984 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2985 nodeProctor.release();
2988 *isInsertedFlag =
true;
3017 template <
class LOOKUP_KEY>
3019 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
3020 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
3037 size_t hashCode = this->d_parameters.hashCodeForKey(key);
3066 template <
class LOOKUP_KEY>
3068 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
3069 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
3071 find(
const LOOKUP_KEY& key)
const
3075 return bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
3078 d_parameters.comparator(),
3079 d_parameters.hashCodeForKey(key));
3116 template <
class LOOKUP_KEY>
3118 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
3119 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
3123 const LOOKUP_KEY& key)
const
3130 *first = this->find(key);
3169 const HASHER&
hasher()
const;
3226template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3227void swap(HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>& x,
3228 HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>& y);
3244template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3246 const HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>& lhs,
3247 const HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>& rhs);
3264template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3266 const HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>& lhs,
3267 const HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>& rhs);
3276template <
class FACTORY>
3277class HashTable_ArrayProctor {
3281 FACTORY *d_factory_p;
3286 HashTable_ArrayProctor(
const HashTable_ArrayProctor&);
3287 HashTable_ArrayProctor& operator=(
const HashTable_ArrayProctor&);
3295 HashTable_ArrayProctor(FACTORY *factory,
3326template <
class FACTORY>
3327class HashTable_NodeProctor {
3331 FACTORY *d_factory_p;
3336 HashTable_NodeProctor(
const HashTable_NodeProctor&);
3337 HashTable_NodeProctor& operator=(
const HashTable_NodeProctor&);
3347 HashTable_NodeProctor(FACTORY *factory,
3371struct HashTable_ImpDetails {
3390 size_t requestedBuckets,
3391 double maxLoadFactor);
3425struct HashTable_Util {
3436 template <
class TYPE>
3438 template <
class TYPE>
3440 template <
class TYPE>
3445 template<
class ALLOCATOR>
3447 std::size_t bucketArraySize,
3448 const ALLOCATOR& allocator);
3457 template<
class ALLOCATOR>
3459 std::size_t bucketArraySize,
3460 const ALLOCATOR& allocator);
3475template <
class HASHER>
3476struct HashTable_BaseHasher
3478 typename CallableVariable<HASHER>::type> >
3482template <
class COMPARATOR>
3483struct HashTable_Comparator
3485 typename CallableVariable<COMPARATOR>::type> >
3493template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3494class HashTable_ImplParameters
3495 :
private HashTable_BaseHasher<HASHER>::Type
3496 ,
private HashTable_Comparator<COMPARATOR>::Type
3508 typedef ALLOCATOR AllocatorType;
3509 typedef ::bsl::allocator_traits<AllocatorType> AllocatorTraits;
3510 typedef typename KEY_CONFIG::ValueType ValueType;
3515 typedef HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>
HashTableType;
3516 typedef typename HashTableType::AllocatorTraits::
3518 typedef typename ReboundTraits::allocator_type
NodeAllocator;
3521 BidirectionalNodePool<typename HashTableType::ValueType, NodeAllocator>
3534 HashTable_ImplParameters(
const HashTable_ImplParameters&);
3535 HashTable_ImplParameters& operator=(
const HashTable_ImplParameters&);
3543 explicit HashTable_ImplParameters(
const ALLOCATOR& allocator);
3548 HashTable_ImplParameters(
const HASHER& hash,
3549 const COMPARATOR& compare,
3550 const ALLOCATOR& allocator);
3555 HashTable_ImplParameters(
const HashTable_ImplParameters& original,
3556 const ALLOCATOR& allocator);
3564 HashTable_ImplParameters(
3597 template <
class DEDUCED_KEY>
3606 template <
class LOOKUP_KEY>
3608 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value,
3616 const BaseHasher&
hasher()
const;
3639template <
class FUNCTOR>
3646template <
class FUNCTOR>
3648HashTable_HashWrapper<FUNCTOR>::HashTable_HashWrapper(
const FUNCTOR& fn)
3653template <
class FUNCTOR>
3654template <
class ARG_TYPE>
3657HashTable_HashWrapper<FUNCTOR>::operator()(ARG_TYPE& arg)
const
3659 return d_functor(arg);
3662template <
class FUNCTOR>
3664const FUNCTOR& HashTable_HashWrapper<FUNCTOR>::functor()
const
3669template <
class FUNCTOR>
3671void HashTable_HashWrapper<FUNCTOR>::swap(HashTable_HashWrapper &other)
3674 swap(d_functor, other.d_functor);
3679template <
class FUNCTOR>
3681HashTable_HashWrapper<const FUNCTOR>::HashTable_HashWrapper()
3686template <
class FUNCTOR>
3688HashTable_HashWrapper<const FUNCTOR>::HashTable_HashWrapper(
const FUNCTOR& fn)
3693template <
class FUNCTOR>
3694template <
class ARG_TYPE>
3697HashTable_HashWrapper<const FUNCTOR>::operator()(ARG_TYPE& arg)
const
3699 return d_functor(arg);
3702template <
class FUNCTOR>
3704const FUNCTOR& HashTable_HashWrapper<const FUNCTOR>::functor()
const
3711template <
class FUNCTOR>
3713HashTable_HashWrapper<FUNCTOR &>::HashTable_HashWrapper(FUNCTOR& fn)
3718template <
class FUNCTOR>
3719template <
class ARG_TYPE>
3722HashTable_HashWrapper<FUNCTOR &>::operator()(ARG_TYPE& arg)
const
3724 return d_functor(arg);
3727template <
class FUNCTOR>
3729FUNCTOR& HashTable_HashWrapper<FUNCTOR &>::functor()
const
3738template <
class FUNCTOR>
3740HashTable_ComparatorWrapper<FUNCTOR>::HashTable_ComparatorWrapper()
3745template <
class FUNCTOR>
3747HashTable_ComparatorWrapper<FUNCTOR>::
3748HashTable_ComparatorWrapper(
const FUNCTOR& fn)
3753template <
class FUNCTOR>
3754template <
class ARG1_TYPE,
class ARG2_TYPE>
3757HashTable_ComparatorWrapper<FUNCTOR>::operator()(ARG1_TYPE& arg1,
3758 ARG2_TYPE& arg2)
const
3760 return d_functor(arg1, arg2);
3763template <
class FUNCTOR>
3764const FUNCTOR& HashTable_ComparatorWrapper<FUNCTOR>::functor()
const
3769template <
class FUNCTOR>
3772HashTable_ComparatorWrapper<FUNCTOR>::swap(HashTable_ComparatorWrapper &other)
3775 swap(d_functor, other.d_functor);
3780template <
class FUNCTOR>
3782HashTable_ComparatorWrapper<const FUNCTOR>::HashTable_ComparatorWrapper()
3787template <
class FUNCTOR>
3789HashTable_ComparatorWrapper<const FUNCTOR>::
3790HashTable_ComparatorWrapper(
const FUNCTOR& fn)
3795template <
class FUNCTOR>
3796template <
class ARG1_TYPE,
class ARG2_TYPE>
3799HashTable_ComparatorWrapper<const FUNCTOR>::operator()(ARG1_TYPE& arg1,
3800 ARG2_TYPE& arg2)
const
3802 return d_functor(arg1, arg2);
3805template <
class FUNCTOR>
3806const FUNCTOR& HashTable_ComparatorWrapper<const FUNCTOR>::functor()
const
3813template <
class FUNCTOR>
3815HashTable_ComparatorWrapper<FUNCTOR &>::
3816HashTable_ComparatorWrapper(FUNCTOR& fn)
3821template <
class FUNCTOR>
3822template <
class ARG1_TYPE,
class ARG2_TYPE>
3825HashTable_ComparatorWrapper<FUNCTOR &>::operator()(ARG1_TYPE& arg1,
3826 ARG2_TYPE& arg2)
const
3828 return d_functor(arg1, arg2);
3831template <
class FUNCTOR>
3833FUNCTOR& HashTable_ComparatorWrapper<FUNCTOR &>::functor()
const
3843template <
class FACTORY>
3845HashTable_NodeProctor<FACTORY>::HashTable_NodeProctor(
3848: d_factory_p(factory)
3854template <
class FACTORY>
3856HashTable_NodeProctor<FACTORY>::~HashTable_NodeProctor()
3859 d_factory_p->deleteNode(d_node_p);
3864template <
class FACTORY>
3866void HashTable_NodeProctor<FACTORY>::release()
3876template <
class FACTORY>
3878HashTable_ArrayProctor<FACTORY>::HashTable_ArrayProctor(
3881: d_factory_p(factory)
3888template <
class FACTORY>
3890HashTable_ArrayProctor<FACTORY>::~HashTable_ArrayProctor()
3893 HashTable_Util::destroyBucketArray(d_anchor_p->bucketArrayAddress(),
3894 d_anchor_p->bucketArraySize(),
3895 d_factory_p->allocator());
3900 d_factory_p->deleteNode(root);
3907template <
class FACTORY>
3909void HashTable_ArrayProctor<FACTORY>::release()
3918template <
class TYPE>
3920void HashTable_Util::assertNotNullPointer(TYPE&)
3924template <
class TYPE>
3926void HashTable_Util::assertNotNullPointer(TYPE *
const& ptr)
3933template <
class TYPE>
3935void HashTable_Util::assertNotNullPointer(TYPE * & ptr)
3942template <
class ALLOCATOR>
3944void HashTable_Util::destroyBucketArray(
3946 std::size_t bucketArraySize,
3947 const ALLOCATOR& allocator)
3951 (1 < bucketArraySize
3952 && HashTable_ImpDetails::defaultBucketAddress() != data)
3953 || (1 == bucketArraySize
3954 && HashTable_ImpDetails::defaultBucketAddress() == data));
3956#ifdef BSLS_ASSERT_SAFE_IS_ACTIVE
3959 bucketArraySize <= std::numeric_limits<AllocSizeType>::max());
3962 if (HashTable_ImpDetails::defaultBucketAddress() != data) {
3968template <
class ALLOCATOR>
3971 std::size_t bucketArraySize,
3972 const ALLOCATOR& allocator)
3977#ifdef BSLS_ASSERT_SAFE_IS_ACTIVE
3980 bucketArraySize <= std::numeric_limits<AllocSizeType>::max());
3984 Bucket *
data = bslma::AllocatorUtil::allocateObject<Bucket>(allocator,
3987 std::fill_n(data, bucketArraySize, Bucket());
3997template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3999HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4000HashTable_ImplParameters(
const ALLOCATOR& allocator)
4003, d_nodeFactory(allocator)
4007template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4009HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4010HashTable_ImplParameters(
const HASHER& hash,
4011 const COMPARATOR& compare,
4012 const ALLOCATOR& allocator)
4014, BaseComparator(compare)
4015, d_nodeFactory(allocator)
4019template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4021HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4022HashTable_ImplParameters(
const HashTable_ImplParameters& original,
4023 const ALLOCATOR& allocator)
4024: BaseHasher(static_cast<const BaseHasher&>(original))
4025, BaseComparator(static_cast<const BaseComparator&>(original))
4026, d_nodeFactory(allocator)
4030template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4032HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4034: BaseHasher(static_cast<const BaseHasher&>(original))
4035, BaseComparator(static_cast<const BaseComparator&>(original))
4036, d_nodeFactory(MoveUtil::move(MoveUtil::access(original).d_nodeFactory))
4041template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4043typename HashTable_ImplParameters<KEY_CONFIG,
4046 ALLOCATOR>::NodeFactory &
4047HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4050 return d_nodeFactory;
4053template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4055void HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4056quickSwapExchangeAllocators(HashTable_ImplParameters *other)
4061 swap(*
static_cast<BaseHasher*
>(
this), *
static_cast<BaseHasher*
>(other));
4063 swap(*
static_cast<BaseComparator*
>(
this),
4064 *
static_cast<BaseComparator*
>(other));
4066 nodeFactory().swapExchangeAllocators(other->nodeFactory());
4069template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4071void HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4072quickSwapRetainAllocators(HashTable_ImplParameters *other)
4077 swap(*
static_cast<BaseHasher*
>(
this), *
static_cast<BaseHasher*
>(other));
4079 swap(*
static_cast<BaseComparator*
>(
this),
4080 *
static_cast<BaseComparator*
>(other));
4082 nodeFactory().swapRetainAllocators(other->nodeFactory());
4086template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4088const typename HashTable_ImplParameters<KEY_CONFIG,
4091 ALLOCATOR>::BaseComparator &
4092HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4098template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4099template <
class DEDUCED_KEY>
4101std::size_t HashTable_ImplParameters<KEY_CONFIG,
4105hashCodeForKey(DEDUCED_KEY& key)
const
4107 return static_cast<const BaseHasher &
>(*this)(key);
4110template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4112const typename HashTable_ImplParameters<KEY_CONFIG,
4115 ALLOCATOR>::BaseHasher &
4116HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::hasher()
4122template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4124const typename HashTable_ImplParameters<KEY_CONFIG,
4127 ALLOCATOR>::NodeFactory &
4128HashTable_ImplParameters<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4131 return d_nodeFactory;
4134template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4137HashTable_ImplParameters<KEY_CONFIG,
4140 ALLOCATOR>::originalComparator()
const
4142 return static_cast<const BaseComparator *
>(
this)->functor();
4145template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4147const HASHER& HashTable_ImplParameters<KEY_CONFIG,
4150 ALLOCATOR>::originalHasher()
const
4152 return static_cast<const BaseHasher *
>(
this)->functor();
4160template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4162HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4163HashTable(
const ALLOCATOR& basicAllocator)
4164: d_parameters(basicAllocator)
4165, d_anchor(HashTable_ImpDetails::defaultBucketAddress(), 1, 0)
4168, d_maxLoadFactor(1.0)
4174template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4176HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4177HashTable(
const HASHER& hash,
4178 const COMPARATOR& compare,
4179 SizeType initialNumBuckets,
4180 float initialMaxLoadFactor,
4181 const ALLOCATOR& basicAllocator)
4182: d_parameters(hash, compare, basicAllocator)
4183, d_anchor(HashTable_ImpDetails::defaultBucketAddress(), 1, 0)
4186, d_maxLoadFactor(initialMaxLoadFactor)
4191 HashTable_Util::assertNotNullPointer(hash);
4194 HashTable_Util::assertNotNullPointer(compare);
4197 if (0 != initialNumBuckets) {
4199 size_t numBuckets = HashTable_ImpDetails::growBucketsForLoadFactor(
4202 static_cast<size_t>(initialNumBuckets),
4204 HashTable_Util::initAnchor(&d_anchor, numBuckets, basicAllocator);
4205 d_capacity =
static_cast<SizeType
>(capacity);
4209template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4211HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4212HashTable(
const HashTable& original)
4214 original.d_parameters,
4215 AllocatorTraits::select_on_container_copy_construction(original.allocator()))
4216, d_anchor(HashTable_ImpDetails::defaultBucketAddress(), 1, 0)
4217, d_size(original.d_size)
4219, d_maxLoadFactor(original.d_maxLoadFactor)
4222 d_parameters.nodeFactory().reserveNodes(original.d_size);
4223 this->copyDataStructure(original.d_anchor.listRootAddress());
4227template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4229HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::HashTable(
4230 BloombergLP::bslmf::MovableRef<HashTable> original)
4231: d_parameters(MoveUtil::move(MoveUtil::access(original).d_parameters))
4232, d_anchor(HashTable_ImpDetails::defaultBucketAddress(), 1, 0)
4235, d_maxLoadFactor(1.0)
4237 HashTable& lvalue = original;
4239 swap(d_anchor, lvalue.d_anchor);
4240 swap(d_size, lvalue.d_size);
4241 swap(d_capacity, lvalue.d_capacity);
4242 swap(d_maxLoadFactor, lvalue.d_maxLoadFactor);
4245template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4247HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4248HashTable(
const HashTable& original,
const ALLOCATOR& basicAllocator)
4249: d_parameters(original.d_parameters, basicAllocator)
4250, d_anchor(HashTable_ImpDetails::defaultBucketAddress(), 1, 0)
4251, d_size(original.d_size)
4253, d_maxLoadFactor(original.d_maxLoadFactor)
4256 d_parameters.nodeFactory().reserveNodes(original.d_size);
4257 this->copyDataStructure(original.d_anchor.listRootAddress());
4261template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4262HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4264 const ALLOCATOR& basicAllocator)
4265: d_parameters(MoveUtil::access(original).d_parameters.originalHasher(),
4266 MoveUtil::access(original).d_parameters.originalComparator(),
4268, d_anchor(HashTable_ImpDetails::defaultBucketAddress(), 1, 0)
4271, d_maxLoadFactor(1.0)
4273 HashTable& lvalue = original;
4275 basicAllocator == lvalue.allocator())) {
4276 d_parameters.nodeFactory().adopt(
4277 MoveUtil::move(lvalue.d_parameters.nodeFactory()));
4279 swap(d_anchor, lvalue.d_anchor);
4280 swap(d_size, lvalue.d_size);
4281 swap(d_capacity, lvalue.d_capacity);
4282 swap(d_maxLoadFactor, lvalue.d_maxLoadFactor);
4285 d_size = lvalue.d_size;
4286 d_maxLoadFactor = lvalue.d_maxLoadFactor;
4290 HashTable_ImpDetails::defaultBucketAddress(), 1, 0);
4292 swap(anchor, lvalue.d_anchor);
4295 lvalue.d_capacity = 0;
4296 lvalue.d_maxLoadFactor = 1.0f;
4298 HashTable_ArrayProctor<typename ImplParameters::NodeFactory>
4299 arrayProctor(&lvalue.d_parameters.nodeFactory(),
4302 d_parameters.nodeFactory().reserveNodes(d_size);
4310template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4312HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::~HashTable()
4314#if defined(BDE_BUILD_TARGET_SAFE_2)
4327 this->d_parameters.hasher(),
4328 HashTable_ImpDetails::incidentalAllocator()));
4331 this->removeAllAndDeallocate();
4335template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4337HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::copyDataStructure(
4350 size_t numBuckets = HashTable_ImpDetails::growBucketsForLoadFactor(
4352 static_cast<size_t>(d_size),
4357 HashTable_Util::initAnchor(&d_anchor, numBuckets, this->allocator());
4361 HashTable_ArrayProctor<typename ImplParameters::NodeFactory>
4362 arrayProctor(&d_parameters.nodeFactory(), &d_anchor);
4364 d_capacity =
static_cast<SizeType
>(capacity);
4372 size_t hashCode = this->hashCodeForNode(cursor);
4374 d_parameters.nodeFactory().cloneNode(*cursor);
4380 while (0 != (cursor = cursor->
nextLink()));
4384 arrayProctor.release();
4387template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4389HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::moveDataStructure(
4402 size_t numBuckets = HashTable_ImpDetails::growBucketsForLoadFactor(
4404 static_cast<size_t>(d_size),
4409 HashTable_Util::initAnchor(&d_anchor, numBuckets, this->allocator());
4411 d_capacity =
static_cast<SizeType
>(capacity);
4415 HashTable_ArrayProctor<typename ImplParameters::NodeFactory>
4416 arrayProctor(&d_parameters.nodeFactory(), &d_anchor);
4424 size_t hashCode = this->hashCodeForNode(cursor);
4426 d_parameters.nodeFactory().moveIntoNewNode(cursor);
4432 while (0 != (cursor = cursor->
nextLink()));
4436 arrayProctor.release();
4439template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4441HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4442quickSwapExchangeAllocators(HashTable *other)
4446 d_parameters.quickSwapExchangeAllocators(&other->d_parameters);
4449 swap(d_anchor, other->d_anchor);
4450 swap(d_size, other->d_size);
4451 swap(d_capacity, other->d_capacity);
4452 swap(d_maxLoadFactor, other->d_maxLoadFactor);
4455template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4457HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4458quickSwapRetainAllocators(HashTable *other)
4463 d_parameters.quickSwapRetainAllocators(&other->d_parameters);
4466 swap(d_anchor, other->d_anchor);
4467 swap(d_size, other->d_size);
4468 swap(d_capacity, other->d_capacity);
4469 swap(d_maxLoadFactor, other->d_maxLoadFactor);
4472template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4474HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4475rehashIntoExactlyNumBuckets(SizeType newNumBuckets, SizeType capacity)
4488 HashTable *d_table_p;
4492#if !defined(BSLS_PLATFORM_CMP_MSVC)
4497 Proctor(
const Proctor&);
4498 Proctor& operator=(
const Proctor&);
4503 Proctor(HashTable *table,
4507 , d_originalAnchor_p(originalAnchor)
4508 , d_newAnchor_p(newAnchor)
4517 if (d_originalAnchor_p) {
4523 d_table_p->removeAll();
4530 HashTable_Util::destroyBucketArray(
4533 d_table_p->allocator());
4539 d_originalAnchor_p = 0;
4551 HashTable_Util::initAnchor(&newAnchor,
4552 static_cast<size_t>(newNumBuckets),
4555 Proctor cleanUpIfUserHashThrows(
this, &d_anchor, &newAnchor);
4558 bslalg::HashTableImpUtil::rehash<KEY_CONFIG>(
4561 this->d_parameters.hasher());
4564 cleanUpIfUserHashThrows.dismiss();
4566 d_anchor.
swap(newAnchor);
4567 d_capacity = capacity;
4570template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4573HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::removeAllAndDeallocate()
4575 this->removeAllImp();
4581template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4583HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::removeAllImp()
4592 BidirectionalLink *next;
4595 d_parameters.nodeFactory().deleteNode(
4596 static_cast<NodeType *
>(root));
4598 while(0 != (root = next));
4603template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4604template <
class DEDUCED_KEY>
4607HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::find(
4609 std::size_t hashValue)
const
4611 return bslalg::HashTableImpUtil::find<KEY_CONFIG>(
4614 d_parameters.comparator(),
4618template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4621HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::getBucketAddress(
4622 SizeType bucketIndex)
const
4629template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4632HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::hashCodeForNode(
4637 return d_parameters.hashCodeForKey(
4638 bslalg::HashTableImpUtil::extractKey<KEY_CONFIG>(node));
4642template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4644HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>&
4645HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::operator=(
4646 const HashTable& rhs)
4650 if (AllocatorTraits::propagate_on_container_copy_assignment::value) {
4651 HashTable other(rhs,
rhs.allocator());
4652 quickSwapExchangeAllocators(&other);
4655 HashTable other(rhs, this->allocator());
4656 quickSwapRetainAllocators(&other);
4662template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4664HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>&
4665HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::operator=(
4668 HashTable& lvalue =
rhs;
4670 if (allocator() == lvalue.allocator()) {
4671 HashTable other(MoveUtil::move(lvalue));
4672 quickSwapRetainAllocators(&other);
4675 AllocatorTraits::propagate_on_container_move_assignment::value) {
4676 HashTable other(MoveUtil::move(lvalue));
4677 quickSwapExchangeAllocators(&other);
4680 HashTable other(MoveUtil::move(lvalue), allocator());
4681 quickSwapRetainAllocators(&other);
4687#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
4690#ifndef BSLSTL_HASHTABLE_VARIADIC_LIMIT
4691#define BSLSTL_HASHTABLE_VARIADIC_LIMIT 10
4693#ifndef BSLSTL_HASHTABLE_VARIADIC_LIMIT_E
4694#define BSLSTL_HASHTABLE_VARIADIC_LIMIT_E BSLSTL_HASHTABLE_VARIADIC_LIMIT
4696#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 0
4697template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4699HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
4705 if (d_size >= d_capacity) {
4706 this->rehashForNumBuckets(numBuckets() * 2);
4711 d_parameters.nodeFactory().emplaceIntoNewNode(
4715 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
4716 nodeProctor(&d_parameters.nodeFactory(), newNode);
4719 size_t hashCode = this->d_parameters.hashCodeForKey(
4720 ImpUtil::extractKey<KEY_CONFIG>(newNode));
4722 ImpUtil::extractKey<KEY_CONFIG>(newNode),
4726 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
4729 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
4731 nodeProctor.release();
4739#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 1
4740template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4741template <
class ARGS_01>
4743HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
4749 if (d_size >= d_capacity) {
4750 this->rehashForNumBuckets(numBuckets() * 2);
4755 d_parameters.nodeFactory().emplaceIntoNewNode(
4759 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
4760 nodeProctor(&d_parameters.nodeFactory(), newNode);
4763 size_t hashCode = this->d_parameters.hashCodeForKey(
4764 ImpUtil::extractKey<KEY_CONFIG>(newNode));
4766 ImpUtil::extractKey<KEY_CONFIG>(newNode),
4770 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
4773 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
4775 nodeProctor.release();
4783#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 2
4784template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4785template <
class ARGS_01,
4788HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
4795 if (d_size >= d_capacity) {
4796 this->rehashForNumBuckets(numBuckets() * 2);
4801 d_parameters.nodeFactory().emplaceIntoNewNode(
4806 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
4807 nodeProctor(&d_parameters.nodeFactory(), newNode);
4810 size_t hashCode = this->d_parameters.hashCodeForKey(
4811 ImpUtil::extractKey<KEY_CONFIG>(newNode));
4813 ImpUtil::extractKey<KEY_CONFIG>(newNode),
4817 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
4820 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
4822 nodeProctor.release();
4830#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 3
4831template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4832template <
class ARGS_01,
4836HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
4844 if (d_size >= d_capacity) {
4845 this->rehashForNumBuckets(numBuckets() * 2);
4850 d_parameters.nodeFactory().emplaceIntoNewNode(
4856 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
4857 nodeProctor(&d_parameters.nodeFactory(), newNode);
4860 size_t hashCode = this->d_parameters.hashCodeForKey(
4861 ImpUtil::extractKey<KEY_CONFIG>(newNode));
4863 ImpUtil::extractKey<KEY_CONFIG>(newNode),
4867 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
4870 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
4872 nodeProctor.release();
4880#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 4
4881template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4882template <
class ARGS_01,
4887HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
4896 if (d_size >= d_capacity) {
4897 this->rehashForNumBuckets(numBuckets() * 2);
4902 d_parameters.nodeFactory().emplaceIntoNewNode(
4909 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
4910 nodeProctor(&d_parameters.nodeFactory(), newNode);
4913 size_t hashCode = this->d_parameters.hashCodeForKey(
4914 ImpUtil::extractKey<KEY_CONFIG>(newNode));
4916 ImpUtil::extractKey<KEY_CONFIG>(newNode),
4920 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
4923 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
4925 nodeProctor.release();
4933#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 5
4934template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4935template <
class ARGS_01,
4941HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
4951 if (d_size >= d_capacity) {
4952 this->rehashForNumBuckets(numBuckets() * 2);
4957 d_parameters.nodeFactory().emplaceIntoNewNode(
4965 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
4966 nodeProctor(&d_parameters.nodeFactory(), newNode);
4969 size_t hashCode = this->d_parameters.hashCodeForKey(
4970 ImpUtil::extractKey<KEY_CONFIG>(newNode));
4972 ImpUtil::extractKey<KEY_CONFIG>(newNode),
4976 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
4979 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
4981 nodeProctor.release();
4989#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 6
4990template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4991template <
class ARGS_01,
4998HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
5009 if (d_size >= d_capacity) {
5010 this->rehashForNumBuckets(numBuckets() * 2);
5015 d_parameters.nodeFactory().emplaceIntoNewNode(
5024 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5025 nodeProctor(&d_parameters.nodeFactory(), newNode);
5028 size_t hashCode = this->d_parameters.hashCodeForKey(
5029 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5031 ImpUtil::extractKey<KEY_CONFIG>(newNode),
5035 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5038 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
5040 nodeProctor.release();
5048#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 7
5049template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5050template <
class ARGS_01,
5058HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
5070 if (d_size >= d_capacity) {
5071 this->rehashForNumBuckets(numBuckets() * 2);
5076 d_parameters.nodeFactory().emplaceIntoNewNode(
5086 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5087 nodeProctor(&d_parameters.nodeFactory(), newNode);
5090 size_t hashCode = this->d_parameters.hashCodeForKey(
5091 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5093 ImpUtil::extractKey<KEY_CONFIG>(newNode),
5097 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5100 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
5102 nodeProctor.release();
5110#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 8
5111template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5112template <
class ARGS_01,
5121HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
5134 if (d_size >= d_capacity) {
5135 this->rehashForNumBuckets(numBuckets() * 2);
5140 d_parameters.nodeFactory().emplaceIntoNewNode(
5151 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5152 nodeProctor(&d_parameters.nodeFactory(), newNode);
5155 size_t hashCode = this->d_parameters.hashCodeForKey(
5156 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5158 ImpUtil::extractKey<KEY_CONFIG>(newNode),
5162 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5165 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
5167 nodeProctor.release();
5175#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 9
5176template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5177template <
class ARGS_01,
5187HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
5201 if (d_size >= d_capacity) {
5202 this->rehashForNumBuckets(numBuckets() * 2);
5207 d_parameters.nodeFactory().emplaceIntoNewNode(
5219 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5220 nodeProctor(&d_parameters.nodeFactory(), newNode);
5223 size_t hashCode = this->d_parameters.hashCodeForKey(
5224 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5226 ImpUtil::extractKey<KEY_CONFIG>(newNode),
5230 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5233 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
5235 nodeProctor.release();
5243#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 10
5244template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5245template <
class ARGS_01,
5256HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
5271 if (d_size >= d_capacity) {
5272 this->rehashForNumBuckets(numBuckets() * 2);
5277 d_parameters.nodeFactory().emplaceIntoNewNode(
5290 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5291 nodeProctor(&d_parameters.nodeFactory(), newNode);
5294 size_t hashCode = this->d_parameters.hashCodeForKey(
5295 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5297 ImpUtil::extractKey<KEY_CONFIG>(newNode),
5301 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5304 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
5306 nodeProctor.release();
5315#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 0
5316template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5318HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5324 if (d_size >= d_capacity) {
5325 this->rehashForNumBuckets(numBuckets() * 2);
5330 d_parameters.nodeFactory().emplaceIntoNewNode(
5334 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5335 nodeProctor(&d_parameters.nodeFactory(), newNode);
5338 size_t hashCode = this->d_parameters.hashCodeForKey(
5339 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5341 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5342 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5343 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5347 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5350 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5352 nodeProctor.release();
5360#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 1
5361template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5362template <
class ARGS_01>
5364HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5371 if (d_size >= d_capacity) {
5372 this->rehashForNumBuckets(numBuckets() * 2);
5377 d_parameters.nodeFactory().emplaceIntoNewNode(
5381 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5382 nodeProctor(&d_parameters.nodeFactory(), newNode);
5385 size_t hashCode = this->d_parameters.hashCodeForKey(
5386 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5388 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5389 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5390 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5394 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5397 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5399 nodeProctor.release();
5407#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 2
5408template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5409template <
class ARGS_01,
5412HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5420 if (d_size >= d_capacity) {
5421 this->rehashForNumBuckets(numBuckets() * 2);
5426 d_parameters.nodeFactory().emplaceIntoNewNode(
5431 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5432 nodeProctor(&d_parameters.nodeFactory(), newNode);
5435 size_t hashCode = this->d_parameters.hashCodeForKey(
5436 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5438 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5439 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5440 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5444 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5447 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5449 nodeProctor.release();
5457#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 3
5458template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5459template <
class ARGS_01,
5463HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5472 if (d_size >= d_capacity) {
5473 this->rehashForNumBuckets(numBuckets() * 2);
5478 d_parameters.nodeFactory().emplaceIntoNewNode(
5484 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5485 nodeProctor(&d_parameters.nodeFactory(), newNode);
5488 size_t hashCode = this->d_parameters.hashCodeForKey(
5489 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5491 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5492 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5493 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5497 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5500 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5502 nodeProctor.release();
5510#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 4
5511template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5512template <
class ARGS_01,
5517HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5527 if (d_size >= d_capacity) {
5528 this->rehashForNumBuckets(numBuckets() * 2);
5533 d_parameters.nodeFactory().emplaceIntoNewNode(
5540 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5541 nodeProctor(&d_parameters.nodeFactory(), newNode);
5544 size_t hashCode = this->d_parameters.hashCodeForKey(
5545 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5547 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5548 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5549 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5553 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5556 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5558 nodeProctor.release();
5566#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 5
5567template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5568template <
class ARGS_01,
5574HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5585 if (d_size >= d_capacity) {
5586 this->rehashForNumBuckets(numBuckets() * 2);
5591 d_parameters.nodeFactory().emplaceIntoNewNode(
5599 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5600 nodeProctor(&d_parameters.nodeFactory(), newNode);
5603 size_t hashCode = this->d_parameters.hashCodeForKey(
5604 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5606 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5607 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5608 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5612 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5615 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5617 nodeProctor.release();
5625#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 6
5626template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5627template <
class ARGS_01,
5634HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5646 if (d_size >= d_capacity) {
5647 this->rehashForNumBuckets(numBuckets() * 2);
5652 d_parameters.nodeFactory().emplaceIntoNewNode(
5661 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5662 nodeProctor(&d_parameters.nodeFactory(), newNode);
5665 size_t hashCode = this->d_parameters.hashCodeForKey(
5666 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5668 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5669 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5670 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5674 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5677 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5679 nodeProctor.release();
5687#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 7
5688template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5689template <
class ARGS_01,
5697HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5710 if (d_size >= d_capacity) {
5711 this->rehashForNumBuckets(numBuckets() * 2);
5716 d_parameters.nodeFactory().emplaceIntoNewNode(
5726 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5727 nodeProctor(&d_parameters.nodeFactory(), newNode);
5730 size_t hashCode = this->d_parameters.hashCodeForKey(
5731 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5733 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5734 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5735 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5739 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5742 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5744 nodeProctor.release();
5752#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 8
5753template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5754template <
class ARGS_01,
5763HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5777 if (d_size >= d_capacity) {
5778 this->rehashForNumBuckets(numBuckets() * 2);
5783 d_parameters.nodeFactory().emplaceIntoNewNode(
5794 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5795 nodeProctor(&d_parameters.nodeFactory(), newNode);
5798 size_t hashCode = this->d_parameters.hashCodeForKey(
5799 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5801 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5802 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5803 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5807 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5810 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5812 nodeProctor.release();
5820#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 9
5821template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5822template <
class ARGS_01,
5832HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5847 if (d_size >= d_capacity) {
5848 this->rehashForNumBuckets(numBuckets() * 2);
5853 d_parameters.nodeFactory().emplaceIntoNewNode(
5865 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5866 nodeProctor(&d_parameters.nodeFactory(), newNode);
5869 size_t hashCode = this->d_parameters.hashCodeForKey(
5870 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5872 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5873 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5874 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5878 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5881 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5883 nodeProctor.release();
5891#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 10
5892template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5893template <
class ARGS_01,
5904HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
5920 if (d_size >= d_capacity) {
5921 this->rehashForNumBuckets(numBuckets() * 2);
5926 d_parameters.nodeFactory().emplaceIntoNewNode(
5939 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5940 nodeProctor(&d_parameters.nodeFactory(), newNode);
5943 size_t hashCode = this->d_parameters.hashCodeForKey(
5944 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5946 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
5947 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5948 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
5952 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
5955 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
5957 nodeProctor.release();
5966#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 0
5967template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5969HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
5970 bool *isInsertedFlag)
5977 if (d_size >= d_capacity) {
5978 this->rehashForNumBuckets(numBuckets() * 2);
5983 d_parameters.nodeFactory().emplaceIntoNewNode(
5987 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
5988 nodeProctor(&d_parameters.nodeFactory(), newNode);
5991 size_t hashCode = this->d_parameters.hashCodeForKey(
5992 ImpUtil::extractKey<KEY_CONFIG>(newNode));
5994 ImpUtil::extractKey<KEY_CONFIG>(newNode),
5997 *isInsertedFlag = (!position);
6000 if (d_size >= d_capacity) {
6001 this->rehashForNumBuckets(numBuckets() * 2);
6004 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6005 nodeProctor.release();
6015#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 1
6016template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6017template <
class ARGS_01>
6019HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6020 bool *isInsertedFlag,
6028 if (d_size >= d_capacity) {
6029 this->rehashForNumBuckets(numBuckets() * 2);
6034 d_parameters.nodeFactory().emplaceIntoNewNode(
6038 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6039 nodeProctor(&d_parameters.nodeFactory(), newNode);
6042 size_t hashCode = this->d_parameters.hashCodeForKey(
6043 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6045 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6048 *isInsertedFlag = (!position);
6051 if (d_size >= d_capacity) {
6052 this->rehashForNumBuckets(numBuckets() * 2);
6055 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6056 nodeProctor.release();
6066#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 2
6067template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6068template <
class ARGS_01,
6071HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6072 bool *isInsertedFlag,
6081 if (d_size >= d_capacity) {
6082 this->rehashForNumBuckets(numBuckets() * 2);
6087 d_parameters.nodeFactory().emplaceIntoNewNode(
6092 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6093 nodeProctor(&d_parameters.nodeFactory(), newNode);
6096 size_t hashCode = this->d_parameters.hashCodeForKey(
6097 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6099 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6102 *isInsertedFlag = (!position);
6105 if (d_size >= d_capacity) {
6106 this->rehashForNumBuckets(numBuckets() * 2);
6109 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6110 nodeProctor.release();
6120#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 3
6121template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6122template <
class ARGS_01,
6126HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6127 bool *isInsertedFlag,
6137 if (d_size >= d_capacity) {
6138 this->rehashForNumBuckets(numBuckets() * 2);
6143 d_parameters.nodeFactory().emplaceIntoNewNode(
6149 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6150 nodeProctor(&d_parameters.nodeFactory(), newNode);
6153 size_t hashCode = this->d_parameters.hashCodeForKey(
6154 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6156 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6159 *isInsertedFlag = (!position);
6162 if (d_size >= d_capacity) {
6163 this->rehashForNumBuckets(numBuckets() * 2);
6166 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6167 nodeProctor.release();
6177#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 4
6178template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6179template <
class ARGS_01,
6184HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6185 bool *isInsertedFlag,
6196 if (d_size >= d_capacity) {
6197 this->rehashForNumBuckets(numBuckets() * 2);
6202 d_parameters.nodeFactory().emplaceIntoNewNode(
6209 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6210 nodeProctor(&d_parameters.nodeFactory(), newNode);
6213 size_t hashCode = this->d_parameters.hashCodeForKey(
6214 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6216 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6219 *isInsertedFlag = (!position);
6222 if (d_size >= d_capacity) {
6223 this->rehashForNumBuckets(numBuckets() * 2);
6226 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6227 nodeProctor.release();
6237#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 5
6238template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6239template <
class ARGS_01,
6245HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6246 bool *isInsertedFlag,
6258 if (d_size >= d_capacity) {
6259 this->rehashForNumBuckets(numBuckets() * 2);
6264 d_parameters.nodeFactory().emplaceIntoNewNode(
6272 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6273 nodeProctor(&d_parameters.nodeFactory(), newNode);
6276 size_t hashCode = this->d_parameters.hashCodeForKey(
6277 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6279 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6282 *isInsertedFlag = (!position);
6285 if (d_size >= d_capacity) {
6286 this->rehashForNumBuckets(numBuckets() * 2);
6289 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6290 nodeProctor.release();
6300#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 6
6301template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6302template <
class ARGS_01,
6309HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6310 bool *isInsertedFlag,
6323 if (d_size >= d_capacity) {
6324 this->rehashForNumBuckets(numBuckets() * 2);
6329 d_parameters.nodeFactory().emplaceIntoNewNode(
6338 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6339 nodeProctor(&d_parameters.nodeFactory(), newNode);
6342 size_t hashCode = this->d_parameters.hashCodeForKey(
6343 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6345 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6348 *isInsertedFlag = (!position);
6351 if (d_size >= d_capacity) {
6352 this->rehashForNumBuckets(numBuckets() * 2);
6355 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6356 nodeProctor.release();
6366#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 7
6367template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6368template <
class ARGS_01,
6376HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6377 bool *isInsertedFlag,
6391 if (d_size >= d_capacity) {
6392 this->rehashForNumBuckets(numBuckets() * 2);
6397 d_parameters.nodeFactory().emplaceIntoNewNode(
6407 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6408 nodeProctor(&d_parameters.nodeFactory(), newNode);
6411 size_t hashCode = this->d_parameters.hashCodeForKey(
6412 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6414 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6417 *isInsertedFlag = (!position);
6420 if (d_size >= d_capacity) {
6421 this->rehashForNumBuckets(numBuckets() * 2);
6424 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6425 nodeProctor.release();
6435#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 8
6436template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6437template <
class ARGS_01,
6446HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6447 bool *isInsertedFlag,
6462 if (d_size >= d_capacity) {
6463 this->rehashForNumBuckets(numBuckets() * 2);
6468 d_parameters.nodeFactory().emplaceIntoNewNode(
6479 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6480 nodeProctor(&d_parameters.nodeFactory(), newNode);
6483 size_t hashCode = this->d_parameters.hashCodeForKey(
6484 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6486 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6489 *isInsertedFlag = (!position);
6492 if (d_size >= d_capacity) {
6493 this->rehashForNumBuckets(numBuckets() * 2);
6496 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6497 nodeProctor.release();
6507#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 9
6508template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6509template <
class ARGS_01,
6519HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6520 bool *isInsertedFlag,
6536 if (d_size >= d_capacity) {
6537 this->rehashForNumBuckets(numBuckets() * 2);
6542 d_parameters.nodeFactory().emplaceIntoNewNode(
6554 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6555 nodeProctor(&d_parameters.nodeFactory(), newNode);
6558 size_t hashCode = this->d_parameters.hashCodeForKey(
6559 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6561 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6564 *isInsertedFlag = (!position);
6567 if (d_size >= d_capacity) {
6568 this->rehashForNumBuckets(numBuckets() * 2);
6571 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6572 nodeProctor.release();
6582#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_E >= 10
6583template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6584template <
class ARGS_01,
6595HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6596 bool *isInsertedFlag,
6613 if (d_size >= d_capacity) {
6614 this->rehashForNumBuckets(numBuckets() * 2);
6619 d_parameters.nodeFactory().emplaceIntoNewNode(
6632 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6633 nodeProctor(&d_parameters.nodeFactory(), newNode);
6636 size_t hashCode = this->d_parameters.hashCodeForKey(
6637 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6639 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6642 *isInsertedFlag = (!position);
6645 if (d_size >= d_capacity) {
6646 this->rehashForNumBuckets(numBuckets() * 2);
6649 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6650 nodeProctor.release();
6663template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6664template <
class... ARGS>
6666HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplace(
6672 if (d_size >= d_capacity) {
6673 this->rehashForNumBuckets(numBuckets() * 2);
6678 d_parameters.nodeFactory().emplaceIntoNewNode(
6682 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6683 nodeProctor(&d_parameters.nodeFactory(), newNode);
6686 size_t hashCode = this->d_parameters.hashCodeForKey(
6687 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6689 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6693 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6696 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
6698 nodeProctor.release();
6705template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6706template <
class... ARGS>
6708HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceWithHint(
6715 if (d_size >= d_capacity) {
6716 this->rehashForNumBuckets(numBuckets() * 2);
6721 d_parameters.nodeFactory().emplaceIntoNewNode(
6725 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6726 nodeProctor(&d_parameters.nodeFactory(), newNode);
6729 size_t hashCode = this->d_parameters.hashCodeForKey(
6730 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6732 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
6733 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
6734 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
6738 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6741 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
6743 nodeProctor.release();
6750template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6751template <
class... ARGS>
6753HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::emplaceIfMissing(
6754 bool *isInsertedFlag,
6762 if (d_size >= d_capacity) {
6763 this->rehashForNumBuckets(numBuckets() * 2);
6768 d_parameters.nodeFactory().emplaceIntoNewNode(
6772 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6773 nodeProctor(&d_parameters.nodeFactory(), newNode);
6776 size_t hashCode = this->d_parameters.hashCodeForKey(
6777 ImpUtil::extractKey<KEY_CONFIG>(newNode));
6779 ImpUtil::extractKey<KEY_CONFIG>(newNode),
6782 *isInsertedFlag = (!position);
6785 if (d_size >= d_capacity) {
6786 this->rehashForNumBuckets(numBuckets() * 2);
6789 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
6790 nodeProctor.release();
6801template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6803HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::insertIfMissing(
6810template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6812HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::insertIfMissing(
6816 return tryEmplace(&dummy,
6818 MoveUtil::move(key));
6821template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6823HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::insertIfMissing(
6824 bool *isInsertedFlag,
6825 const ValueType& value)
6829 size_t hashCode = this->d_parameters.hashCodeForKey(
6830 KEY_CONFIG::extractKey(value));
6832 KEY_CONFIG::extractKey(value),
6835 *isInsertedFlag = (!position);
6838 if (d_size >= d_capacity) {
6839 this->rehashForNumBuckets(numBuckets() * 2);
6842 position = d_parameters.nodeFactory().emplaceIntoNewNode(value);
6852template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6854HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::insertIfMissing(
6855 bool *isInsertedFlag,
6858 ValueType& lvalue = value;
6862 size_t hashCode = this->d_parameters.hashCodeForKey(
6863 KEY_CONFIG::extractKey(lvalue));
6865 KEY_CONFIG::extractKey(lvalue),
6868 *isInsertedFlag = (!position);
6871 if (d_size >= d_capacity) {
6872 this->rehashForNumBuckets(numBuckets() * 2);
6875 position = d_parameters.nodeFactory().emplaceIntoNewNode(
6876 MoveUtil::move(lvalue));
6886template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6887template <
class SOURCE_TYPE>
6890HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::insertIfMissing(
6891 bool *isInsertedFlag,
6896 return emplaceIfMissing(isInsertedFlag,
6901template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6902template <
class SOURCE_TYPE>
6905HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::insert(
6911template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6912template <
class SOURCE_TYPE>
6915HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::insert(
6919 return emplaceWithHint(hint,
6926template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6927template <
class KEY_ARG,
class BDE_OTHER_TYPE>
6929HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::insertOrAssign(
6930 bool *isInsertedFlag,
6937 const KEY_ARG& lvalue = key;
6938 size_t hashCode = this->d_parameters.hashCodeForKey(lvalue);
6940 || !d_parameters.comparator()(lvalue,
6941 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
6942 hint = this->find(lvalue, hashCode);
6946 static_cast<NodeType *
>(hint)->value().second =
6948 *isInsertedFlag =
false;
6952 if (d_size >= d_capacity) {
6953 this->rehashForNumBuckets(numBuckets() * 2);
6956 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
6960 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
6961 nodeProctor(&d_parameters.nodeFactory(), hint);
6962 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
6963 nodeProctor.release();
6966 *isInsertedFlag =
true;
6971template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6973HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::rehashForNumBuckets(
6974 SizeType newNumBuckets)
6976 if (newNumBuckets > this->numBuckets()) {
6981 SizeType numBuckets =
static_cast<SizeType
>(
6982 HashTable_ImpDetails::growBucketsForLoadFactor(
6985 static_cast<size_t>(newNumBuckets),
6988 this->rehashIntoExactlyNumBuckets(numBuckets,
6989 static_cast<SizeType
>(capacity));
6993template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
6995HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::remove(
7006 hashCodeForNode(node));
7009 d_parameters.nodeFactory().deleteNode(
static_cast<NodeType *
>(node));
7014template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7016HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::removeAll()
7018 this->removeAllImp();
7019 if (HashTable_ImpDetails::defaultBucketAddress() !=
7031template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7034HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::reserveForNumElements(
7035 SizeType numElements)
7037 if (numElements < 1) {
7041 if (numElements > d_capacity) {
7046 SizeType numBuckets =
static_cast<SizeType
>(
7047 HashTable_ImpDetails::growBucketsForLoadFactor(
7050 static_cast<size_t>(this->numBuckets()),
7053 this->rehashIntoExactlyNumBuckets(numBuckets,
7054 static_cast<SizeType
>(capacity));
7058template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7060void HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::setMaxLoadFactor(
7061 float newMaxLoadFactor)
7066 SizeType numBuckets =
static_cast<SizeType
>(
7067 HashTable_ImpDetails::growBucketsForLoadFactor(
7069 std::max<SizeType>(d_size, 1u),
7070 static_cast<size_t>(this->numBuckets()),
7073 this->rehashIntoExactlyNumBuckets(numBuckets,
7074 static_cast<SizeType
>(capacity));
7078 d_maxLoadFactor = newMaxLoadFactor;
7081template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7083HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::swap(HashTable& other)
7087 if (AllocatorTraits::propagate_on_container_swap::value) {
7088 quickSwapExchangeAllocators(&other);
7094 BSLS_ASSERT(d_parameters.nodeFactory().allocator() ==
7095 other.d_parameters.nodeFactory().allocator());
7096 quickSwapRetainAllocators(&other);
7100#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
7103#ifndef BSLSTL_HASHTABLE_VARIADIC_LIMIT
7104#define BSLSTL_HASHTABLE_VARIADIC_LIMIT 10
7106#ifndef BSLSTL_HASHTABLE_VARIADIC_LIMIT_G
7107#define BSLSTL_HASHTABLE_VARIADIC_LIMIT_G BSLSTL_HASHTABLE_VARIADIC_LIMIT
7109#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 0
7110template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7113HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7114 bool *isInsertedFlag,
7120 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7123 || !d_parameters.comparator()(key,
7124 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7125 hint = this->find(key, hashCode);
7129 *isInsertedFlag =
false;
7133 if (d_size >= d_capacity) {
7134 this->rehashForNumBuckets(numBuckets() * 2);
7137#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7138 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7139 std::piecewise_construct,
7140 std::forward_as_tuple(key),
7141 std::forward_as_tuple());
7143 typedef typename ValueType::second_type MappedType;
7146 AllocatorType alloc = this->allocator();
7149 AllocatorTraits::construct(alloc, defaultMapped.
address());
7152 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7157 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
7158 nodeProctor(&d_parameters.nodeFactory(), hint);
7159 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
7160 nodeProctor.release();
7163 *isInsertedFlag =
true;
7168#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 1
7169template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7170template <
class ARGS_01>
7173HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7174 bool *isInsertedFlag,
7181 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7184 || !d_parameters.comparator()(key,
7185 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7186 hint = this->find(key, hashCode);
7190 *isInsertedFlag =
false;
7194 if (d_size >= d_capacity) {
7195 this->rehashForNumBuckets(numBuckets() * 2);
7198#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7199 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7200 std::piecewise_construct,
7201 std::forward_as_tuple(key),
7202 std::forward_as_tuple(
7205 typedef typename ValueType::second_type MappedType;
7208 AllocatorType alloc = this->allocator();
7211 AllocatorTraits::construct(alloc, defaultMapped.
address(),
7216 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7221 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
7222 nodeProctor(&d_parameters.nodeFactory(), hint);
7223 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
7224 nodeProctor.release();
7227 *isInsertedFlag =
true;
7232#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 2
7233template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7234template <
class ARGS_01,
7238HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7239 bool *isInsertedFlag,
7247 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7250 || !d_parameters.comparator()(key,
7251 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7252 hint = this->find(key, hashCode);
7256 *isInsertedFlag =
false;
7260 if (d_size >= d_capacity) {
7261 this->rehashForNumBuckets(numBuckets() * 2);
7264#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7265 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7266 std::piecewise_construct,
7267 std::forward_as_tuple(key),
7268 std::forward_as_tuple(
7272 typedef typename ValueType::second_type MappedType;
7275 AllocatorType alloc = this->allocator();
7278 AllocatorTraits::construct(alloc, defaultMapped.
address(),
7285 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7290 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
7291 nodeProctor(&d_parameters.nodeFactory(), hint);
7292 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
7293 nodeProctor.release();
7296 *isInsertedFlag =
true;
7301#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 3
7302template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7303template <
class ARGS_01,
7308HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7309 bool *isInsertedFlag,
7318 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7321 || !d_parameters.comparator()(key,
7322 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7323 hint = this->find(key, hashCode);
7327 *isInsertedFlag =
false;
7331 if (d_size >= d_capacity) {
7332 this->rehashForNumBuckets(numBuckets() * 2);
7335#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7336 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7337 std::piecewise_construct,
7338 std::forward_as_tuple(key),
7339 std::forward_as_tuple(
7344 typedef typename ValueType::second_type MappedType;
7347 AllocatorType alloc = this->allocator();
7350 AllocatorTraits::construct(alloc, defaultMapped.
address(),
7359 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7364 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
7365 nodeProctor(&d_parameters.nodeFactory(), hint);
7366 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
7367 nodeProctor.release();
7370 *isInsertedFlag =
true;
7375#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 4
7376template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7377template <
class ARGS_01,
7383HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7384 bool *isInsertedFlag,
7394 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7397 || !d_parameters.comparator()(key,
7398 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7399 hint = this->find(key, hashCode);
7403 *isInsertedFlag =
false;
7407 if (d_size >= d_capacity) {
7408 this->rehashForNumBuckets(numBuckets() * 2);
7411#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7412 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7413 std::piecewise_construct,
7414 std::forward_as_tuple(key),
7415 std::forward_as_tuple(
7421 typedef typename ValueType::second_type MappedType;
7424 AllocatorType alloc = this->allocator();
7427 AllocatorTraits::construct(alloc, defaultMapped.
address(),
7438 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7443 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
7444 nodeProctor(&d_parameters.nodeFactory(), hint);
7445 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
7446 nodeProctor.release();
7449 *isInsertedFlag =
true;
7454#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 5
7455template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7456template <
class ARGS_01,
7463HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7464 bool *isInsertedFlag,
7475 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7478 || !d_parameters.comparator()(key,
7479 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7480 hint = this->find(key, hashCode);
7484 *isInsertedFlag =
false;
7488 if (d_size >= d_capacity) {
7489 this->rehashForNumBuckets(numBuckets() * 2);
7492#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7493 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7494 std::piecewise_construct,
7495 std::forward_as_tuple(key),
7496 std::forward_as_tuple(
7503 typedef typename ValueType::second_type MappedType;
7506 AllocatorType alloc = this->allocator();
7509 AllocatorTraits::construct(alloc, defaultMapped.
address(),
7522 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7527 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
7528 nodeProctor(&d_parameters.nodeFactory(), hint);
7529 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
7530 nodeProctor.release();
7533 *isInsertedFlag =
true;
7538#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 6
7539template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7540template <
class ARGS_01,
7548HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7549 bool *isInsertedFlag,
7561 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7564 || !d_parameters.comparator()(key,
7565 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7566 hint = this->find(key, hashCode);
7570 *isInsertedFlag =
false;
7574 if (d_size >= d_capacity) {
7575 this->rehashForNumBuckets(numBuckets() * 2);
7578#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7579 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7580 std::piecewise_construct,
7581 std::forward_as_tuple(key),
7582 std::forward_as_tuple(
7590 typedef typename ValueType::second_type MappedType;
7593 AllocatorType alloc = this->allocator();
7596 AllocatorTraits::construct(alloc, defaultMapped.
address(),
7611 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7616 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
7617 nodeProctor(&d_parameters.nodeFactory(), hint);
7618 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
7619 nodeProctor.release();
7622 *isInsertedFlag =
true;
7627#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 7
7628template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7629template <
class ARGS_01,
7638HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7639 bool *isInsertedFlag,
7652 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7655 || !d_parameters.comparator()(key,
7656 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7657 hint = this->find(key, hashCode);
7661 *isInsertedFlag =
false;
7665 if (d_size >= d_capacity) {
7666 this->rehashForNumBuckets(numBuckets() * 2);
7669#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7670 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7671 std::piecewise_construct,
7672 std::forward_as_tuple(key),
7673 std::forward_as_tuple(
7682 typedef typename ValueType::second_type MappedType;
7685 AllocatorType alloc = this->allocator();
7688 AllocatorTraits::construct(alloc, defaultMapped.
address(),
7705 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7710 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
7711 nodeProctor(&d_parameters.nodeFactory(), hint);
7712 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
7713 nodeProctor.release();
7716 *isInsertedFlag =
true;
7721#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 8
7722template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7723template <
class ARGS_01,
7733HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7734 bool *isInsertedFlag,
7748 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7751 || !d_parameters.comparator()(key,
7752 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7753 hint = this->find(key, hashCode);
7757 *isInsertedFlag =
false;
7761 if (d_size >= d_capacity) {
7762 this->rehashForNumBuckets(numBuckets() * 2);
7765#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7766 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7767 std::piecewise_construct,
7768 std::forward_as_tuple(key),
7769 std::forward_as_tuple(
7779 typedef typename ValueType::second_type MappedType;
7782 AllocatorType alloc = this->allocator();
7785 AllocatorTraits::construct(alloc, defaultMapped.
address(),
7804 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7809 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
7810 nodeProctor(&d_parameters.nodeFactory(), hint);
7811 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
7812 nodeProctor.release();
7815 *isInsertedFlag =
true;
7820#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 9
7821template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7822template <
class ARGS_01,
7833HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7834 bool *isInsertedFlag,
7849 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7852 || !d_parameters.comparator()(key,
7853 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7854 hint = this->find(key, hashCode);
7858 *isInsertedFlag =
false;
7862 if (d_size >= d_capacity) {
7863 this->rehashForNumBuckets(numBuckets() * 2);
7866#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7867 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7868 std::piecewise_construct,
7869 std::forward_as_tuple(key),
7870 std::forward_as_tuple(
7881 typedef typename ValueType::second_type MappedType;
7884 AllocatorType alloc = this->allocator();
7887 AllocatorTraits::construct(alloc, defaultMapped.
address(),
7908 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7913 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
7914 nodeProctor(&d_parameters.nodeFactory(), hint);
7915 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
7916 nodeProctor.release();
7919 *isInsertedFlag =
true;
7924#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 10
7925template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
7926template <
class ARGS_01,
7938HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
7939 bool *isInsertedFlag,
7955 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
7958 || !d_parameters.comparator()(key,
7959 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
7960 hint = this->find(key, hashCode);
7964 *isInsertedFlag =
false;
7968 if (d_size >= d_capacity) {
7969 this->rehashForNumBuckets(numBuckets() * 2);
7972#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7973 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
7974 std::piecewise_construct,
7975 std::forward_as_tuple(key),
7976 std::forward_as_tuple(
7988 typedef typename ValueType::second_type MappedType;
7991 AllocatorType alloc = this->allocator();
7994 AllocatorTraits::construct(alloc, defaultMapped.
address(),
8017 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8022 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8023 nodeProctor(&d_parameters.nodeFactory(), hint);
8024 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8025 nodeProctor.release();
8028 *isInsertedFlag =
true;
8035#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 0
8036template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8039HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8040 bool *isInsertedFlag,
8046 const KeyType& lvalue = key;
8047 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8050 || !d_parameters.comparator()(lvalue,
8051 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8052 hint = this->find(lvalue, hashCode);
8056 *isInsertedFlag =
false;
8060 if (d_size >= d_capacity) {
8061 this->rehashForNumBuckets(numBuckets() * 2);
8064#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8065 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8066 std::piecewise_construct,
8067 std::forward_as_tuple(MoveUtil::move(key)),
8068 std::forward_as_tuple(
8071 typedef typename ValueType::second_type MappedType;
8074 AllocatorType alloc = this->allocator();
8077 AllocatorTraits::construct(alloc, defaultMapped.
address());
8080 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8081 MoveUtil::move(key),
8085 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8086 nodeProctor(&d_parameters.nodeFactory(), hint);
8087 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8088 nodeProctor.release();
8091 *isInsertedFlag =
true;
8096#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 1
8097template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8098template <
class ARGS_01>
8101HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8102 bool *isInsertedFlag,
8109 const KeyType& lvalue = key;
8110 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8113 || !d_parameters.comparator()(lvalue,
8114 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8115 hint = this->find(lvalue, hashCode);
8119 *isInsertedFlag =
false;
8123 if (d_size >= d_capacity) {
8124 this->rehashForNumBuckets(numBuckets() * 2);
8127#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8128 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8129 std::piecewise_construct,
8130 std::forward_as_tuple(MoveUtil::move(key)),
8131 std::forward_as_tuple(
8135 typedef typename ValueType::second_type MappedType;
8138 AllocatorType alloc = this->allocator();
8141 AllocatorTraits::construct(alloc, defaultMapped.
address(),
8146 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8147 MoveUtil::move(key),
8151 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8152 nodeProctor(&d_parameters.nodeFactory(), hint);
8153 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8154 nodeProctor.release();
8157 *isInsertedFlag =
true;
8162#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 2
8163template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8164template <
class ARGS_01,
8168HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8169 bool *isInsertedFlag,
8177 const KeyType& lvalue = key;
8178 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8181 || !d_parameters.comparator()(lvalue,
8182 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8183 hint = this->find(lvalue, hashCode);
8187 *isInsertedFlag =
false;
8191 if (d_size >= d_capacity) {
8192 this->rehashForNumBuckets(numBuckets() * 2);
8195#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8196 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8197 std::piecewise_construct,
8198 std::forward_as_tuple(MoveUtil::move(key)),
8199 std::forward_as_tuple(
8205 typedef typename ValueType::second_type MappedType;
8208 AllocatorType alloc = this->allocator();
8211 AllocatorTraits::construct(alloc, defaultMapped.
address(),
8218 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8219 MoveUtil::move(key),
8223 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8224 nodeProctor(&d_parameters.nodeFactory(), hint);
8225 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8226 nodeProctor.release();
8229 *isInsertedFlag =
true;
8234#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 3
8235template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8236template <
class ARGS_01,
8241HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8242 bool *isInsertedFlag,
8251 const KeyType& lvalue = key;
8252 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8255 || !d_parameters.comparator()(lvalue,
8256 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8257 hint = this->find(lvalue, hashCode);
8261 *isInsertedFlag =
false;
8265 if (d_size >= d_capacity) {
8266 this->rehashForNumBuckets(numBuckets() * 2);
8269#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8270 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8271 std::piecewise_construct,
8272 std::forward_as_tuple(MoveUtil::move(key)),
8273 std::forward_as_tuple(
8281 typedef typename ValueType::second_type MappedType;
8284 AllocatorType alloc = this->allocator();
8287 AllocatorTraits::construct(alloc, defaultMapped.
address(),
8296 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8297 MoveUtil::move(key),
8301 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8302 nodeProctor(&d_parameters.nodeFactory(), hint);
8303 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8304 nodeProctor.release();
8307 *isInsertedFlag =
true;
8312#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 4
8313template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8314template <
class ARGS_01,
8320HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8321 bool *isInsertedFlag,
8331 const KeyType& lvalue = key;
8332 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8335 || !d_parameters.comparator()(lvalue,
8336 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8337 hint = this->find(lvalue, hashCode);
8341 *isInsertedFlag =
false;
8345 if (d_size >= d_capacity) {
8346 this->rehashForNumBuckets(numBuckets() * 2);
8349#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8350 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8351 std::piecewise_construct,
8352 std::forward_as_tuple(MoveUtil::move(key)),
8353 std::forward_as_tuple(
8363 typedef typename ValueType::second_type MappedType;
8366 AllocatorType alloc = this->allocator();
8369 AllocatorTraits::construct(alloc, defaultMapped.
address(),
8380 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8381 MoveUtil::move(key),
8385 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8386 nodeProctor(&d_parameters.nodeFactory(), hint);
8387 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8388 nodeProctor.release();
8391 *isInsertedFlag =
true;
8396#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 5
8397template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8398template <
class ARGS_01,
8405HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8406 bool *isInsertedFlag,
8417 const KeyType& lvalue = key;
8418 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8421 || !d_parameters.comparator()(lvalue,
8422 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8423 hint = this->find(lvalue, hashCode);
8427 *isInsertedFlag =
false;
8431 if (d_size >= d_capacity) {
8432 this->rehashForNumBuckets(numBuckets() * 2);
8435#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8436 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8437 std::piecewise_construct,
8438 std::forward_as_tuple(MoveUtil::move(key)),
8439 std::forward_as_tuple(
8451 typedef typename ValueType::second_type MappedType;
8454 AllocatorType alloc = this->allocator();
8457 AllocatorTraits::construct(alloc, defaultMapped.
address(),
8470 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8471 MoveUtil::move(key),
8475 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8476 nodeProctor(&d_parameters.nodeFactory(), hint);
8477 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8478 nodeProctor.release();
8481 *isInsertedFlag =
true;
8486#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 6
8487template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8488template <
class ARGS_01,
8496HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8497 bool *isInsertedFlag,
8509 const KeyType& lvalue = key;
8510 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8513 || !d_parameters.comparator()(lvalue,
8514 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8515 hint = this->find(lvalue, hashCode);
8519 *isInsertedFlag =
false;
8523 if (d_size >= d_capacity) {
8524 this->rehashForNumBuckets(numBuckets() * 2);
8527#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8528 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8529 std::piecewise_construct,
8530 std::forward_as_tuple(MoveUtil::move(key)),
8531 std::forward_as_tuple(
8545 typedef typename ValueType::second_type MappedType;
8548 AllocatorType alloc = this->allocator();
8551 AllocatorTraits::construct(alloc, defaultMapped.
address(),
8566 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8567 MoveUtil::move(key),
8571 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8572 nodeProctor(&d_parameters.nodeFactory(), hint);
8573 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8574 nodeProctor.release();
8577 *isInsertedFlag =
true;
8582#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 7
8583template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8584template <
class ARGS_01,
8593HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8594 bool *isInsertedFlag,
8607 const KeyType& lvalue = key;
8608 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8611 || !d_parameters.comparator()(lvalue,
8612 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8613 hint = this->find(lvalue, hashCode);
8617 *isInsertedFlag =
false;
8621 if (d_size >= d_capacity) {
8622 this->rehashForNumBuckets(numBuckets() * 2);
8625#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8626 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8627 std::piecewise_construct,
8628 std::forward_as_tuple(MoveUtil::move(key)),
8629 std::forward_as_tuple(
8645 typedef typename ValueType::second_type MappedType;
8648 AllocatorType alloc = this->allocator();
8651 AllocatorTraits::construct(alloc, defaultMapped.
address(),
8668 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8669 MoveUtil::move(key),
8673 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8674 nodeProctor(&d_parameters.nodeFactory(), hint);
8675 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8676 nodeProctor.release();
8679 *isInsertedFlag =
true;
8684#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 8
8685template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8686template <
class ARGS_01,
8696HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8697 bool *isInsertedFlag,
8711 const KeyType& lvalue = key;
8712 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8715 || !d_parameters.comparator()(lvalue,
8716 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8717 hint = this->find(lvalue, hashCode);
8721 *isInsertedFlag =
false;
8725 if (d_size >= d_capacity) {
8726 this->rehashForNumBuckets(numBuckets() * 2);
8729#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8730 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8731 std::piecewise_construct,
8732 std::forward_as_tuple(MoveUtil::move(key)),
8733 std::forward_as_tuple(
8751 typedef typename ValueType::second_type MappedType;
8754 AllocatorType alloc = this->allocator();
8757 AllocatorTraits::construct(alloc, defaultMapped.
address(),
8776 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8777 MoveUtil::move(key),
8781 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8782 nodeProctor(&d_parameters.nodeFactory(), hint);
8783 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8784 nodeProctor.release();
8787 *isInsertedFlag =
true;
8792#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 9
8793template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8794template <
class ARGS_01,
8805HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8806 bool *isInsertedFlag,
8821 const KeyType& lvalue = key;
8822 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8825 || !d_parameters.comparator()(lvalue,
8826 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8827 hint = this->find(lvalue, hashCode);
8831 *isInsertedFlag =
false;
8835 if (d_size >= d_capacity) {
8836 this->rehashForNumBuckets(numBuckets() * 2);
8839#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8840 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8841 std::piecewise_construct,
8842 std::forward_as_tuple(MoveUtil::move(key)),
8843 std::forward_as_tuple(
8863 typedef typename ValueType::second_type MappedType;
8866 AllocatorType alloc = this->allocator();
8869 AllocatorTraits::construct(alloc, defaultMapped.
address(),
8890 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8891 MoveUtil::move(key),
8895 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
8896 nodeProctor(&d_parameters.nodeFactory(), hint);
8897 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
8898 nodeProctor.release();
8901 *isInsertedFlag =
true;
8906#if BSLSTL_HASHTABLE_VARIADIC_LIMIT_G >= 10
8907template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
8908template <
class ARGS_01,
8920HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
8921 bool *isInsertedFlag,
8937 const KeyType& lvalue = key;
8938 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
8941 || !d_parameters.comparator()(lvalue,
8942 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
8943 hint = this->find(lvalue, hashCode);
8947 *isInsertedFlag =
false;
8951 if (d_size >= d_capacity) {
8952 this->rehashForNumBuckets(numBuckets() * 2);
8955#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8956 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
8957 std::piecewise_construct,
8958 std::forward_as_tuple(MoveUtil::move(key)),
8959 std::forward_as_tuple(
8981 typedef typename ValueType::second_type MappedType;
8984 AllocatorType alloc = this->allocator();
8987 AllocatorTraits::construct(alloc, defaultMapped.
address(),
9010 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
9011 MoveUtil::move(key),
9015 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
9016 nodeProctor(&d_parameters.nodeFactory(), hint);
9017 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
9018 nodeProctor.release();
9021 *isInsertedFlag =
true;
9029template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9030template <
class... ARGS>
9033HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
9034 bool *isInsertedFlag,
9041 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
9044 || !d_parameters.comparator()(key,
9045 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
9046 hint = this->find(key, hashCode);
9050 *isInsertedFlag =
false;
9054 if (d_size >= d_capacity) {
9055 this->rehashForNumBuckets(numBuckets() * 2);
9058#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
9059 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
9060 std::piecewise_construct,
9061 std::forward_as_tuple(key),
9064 typedef typename ValueType::second_type MappedType;
9067 AllocatorType alloc = this->allocator();
9070 AllocatorTraits::construct(alloc, defaultMapped.
address(),
9075 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
9080 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
9081 nodeProctor(&d_parameters.nodeFactory(), hint);
9082 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
9083 nodeProctor.release();
9086 *isInsertedFlag =
true;
9091template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9092template <
class... ARGS>
9095HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::tryEmplace(
9096 bool *isInsertedFlag,
9103 const KeyType& lvalue = key;
9104 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
9107 || !d_parameters.comparator()(lvalue,
9108 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
9109 hint = this->find(lvalue, hashCode);
9113 *isInsertedFlag =
false;
9117 if (d_size >= d_capacity) {
9118 this->rehashForNumBuckets(numBuckets() * 2);
9121#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
9122 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
9123 std::piecewise_construct,
9124 std::forward_as_tuple(MoveUtil::move(key)),
9125 std::forward_as_tuple(
9129 typedef typename ValueType::second_type MappedType;
9132 AllocatorType alloc = this->allocator();
9135 AllocatorTraits::construct(alloc, defaultMapped.
address(),
9140 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
9141 MoveUtil::move(key),
9145 HashTable_NodeProctor<typename ImplParameters::NodeFactory>
9146 nodeProctor(&d_parameters.nodeFactory(), hint);
9147 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
9148 nodeProctor.release();
9151 *isInsertedFlag =
true;
9158template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9160ALLOCATOR HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
9163 return d_parameters.nodeFactory().allocator();
9166template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9169HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::bucketAtIndex(
9170 SizeType index)
const
9177template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9179typename HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::SizeType
9180HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::bucketIndexForKey(
9181 const KeyType& key)
const
9184 HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::SizeType SizeType;
9193 size_t hashCode = this->d_parameters.hashCodeForKey(key);
9199template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9202HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::comparator()
const
9204 return d_parameters.originalComparator();
9207template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9209typename HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::SizeType
9210HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::countElementsInBucket(
9211 SizeType index)
const
9215 return static_cast<SizeType
>(bucketAtIndex(index).countElements());
9218template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9221HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::elementListRoot()
const
9226template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9229HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::find(
9230 const KeyType& key)
const
9232 return bslalg::HashTableImpUtil::find<KEY_CONFIG>(
9235 d_parameters.comparator(),
9236 d_parameters.hashCodeForKey(key));
9239template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9241HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::findEndOfRange(
9255 KeyRef k = ImpUtil::extractKey<KEY_CONFIG>(first);
9257 while (0 != (first = first->
nextLink()) &&
9258 d_parameters.comparator()(k,ImpUtil::extractKey<KEY_CONFIG>(first)))
9265template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9268HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::findRange(
9271 const KeyType& key)
const
9276 *first = this->find(key);
9277 *last = *first ? this->findEndOfRange(*first) : 0;
9280template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9282HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::hasSameValue(
9283 const HashTable& other)
const
9297 typedef typename KEY_CONFIG::ValueType ValueType;
9298 typedef typename ::bsl::allocator_traits<ALLOCATOR>::size_type SizeType;
9303 if (this->
size() != other.size()) {
9313 ImpUtil::find<KEY_CONFIG>(other.d_anchor,
9314 ImpUtil::extractKey<KEY_CONFIG>(cursor),
9315 other.d_parameters.comparator(),
9316 other.d_parameters.hashCodeForKey(
9317 ImpUtil::extractKey<KEY_CONFIG>(cursor)));
9330 while (endWalker != endRange) {
9332 if (rhsWalker == rhsLast) {
9339 if (rhsWalker != rhsLast) {
9348 while (cursor != endRange &&
9349 (ImpUtil::extractValue<KEY_CONFIG>(cursor) ==
9350 ImpUtil::extractValue<KEY_CONFIG>(rhsFirst)))
9356 if (cursor == endRange) {
9377 const ValueType& valueAtMarker =
9378 ImpUtil::extractValue<KEY_CONFIG>(marker);
9380 if (cursor != marker) {
9384 while (scanner != marker &&
9385 ImpUtil::extractValue<KEY_CONFIG>(scanner) != valueAtMarker) {
9388 if (scanner != marker) {
9393 SizeType matches = 0;
9397 if (ImpUtil::extractValue<KEY_CONFIG>(scanner) ==
9409 scanner != endRange;
9412 if (ImpUtil::extractValue<KEY_CONFIG>(scanner) ==
9428template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9431HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::hasher()
const
9433 return d_parameters.originalHasher();
9436template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9438float HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::loadFactor()
const
9440 return static_cast<float>(
static_cast<double>(this->
size())
9441 /
static_cast<double>(this->numBuckets()));
9444template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9447HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::maxLoadFactor()
const
9449 return d_maxLoadFactor;
9452template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9454typename HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::SizeType
9455HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::maxNumBuckets()
const
9462 typedef typename AllocatorTraits::
9463 template rebind_traits<bslalg::HashTableBucket>
9464 BucketAllocatorTraits;
9465 typedef typename BucketAllocatorTraits::allocator_type BucketAllocator;
9467 return BucketAllocatorTraits::max_size(BucketAllocator(this->allocator()));
9470template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9472typename HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::SizeType
9473HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::maxSize()
const
9475 return AllocatorTraits::max_size(this->allocator()) /
sizeof(NodeType);
9478template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9480typename HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::SizeType
9481HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::numBuckets()
const
9486template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9488typename HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::SizeType
9489HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::rehashThreshold()
const
9494template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9496typename HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::SizeType
9497HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::size()
const
9508template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9533template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9539 return lhs.hasSameValue(rhs);
9542template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9551template <
class FUNCTOR>
9559template <
class FUNCTOR>
9579template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9580struct UsesBslmaAllocator<
bslstl::HashTable<KEY_CONFIG,
9587template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9588struct UsesBslmaAllocator<
bslstl::HashTable_ImplParameters<KEY_CONFIG,
9599template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
9600struct IsBitwiseMoveable<
bslstl::HashTable<KEY_CONFIG,
9605 && bslmf::IsBitwiseMoveable<COMPARATOR>::value
9606 && bslmf::IsBitwiseMoveable<ALLOCATOR>::value>
9613# error Not valid except when included from bslstl_hashtable.h
Definition bslma_bslallocator.h:588
Definition bslalg_bidirectionallink.h:347
BidirectionalLink * nextLink() const
Return the address of the next node linked from this node.
Definition bslalg_bidirectionallink.h:422
BidirectionalLink * previousLink() const
Return the address of the preceding node linked from this node.
Definition bslalg_bidirectionallink.h:428
Definition bslalg_bidirectionalnode.h:357
Definition bslalg_functoradapter.h:230
HashTable_HashWrapper< CallableVariable< HASHER >::type > Type
This typedef is an alias for the functor.
Definition bslalg_functoradapter.h:236
Definition bslalg_hashtableanchor.h:542
BidirectionalLink * listRootAddress() const
Return the value listRootAddress attribute of this object.
Definition bslalg_hashtableanchor.h:695
void setBucketArrayAddressAndSize(HashTableBucket *bucketArrayAddress, std::size_t bucketArraySize)
Definition bslalg_hashtableanchor.h:666
std::size_t bucketArraySize() const
Return the value of the bucketArraySize attribute of this object.
Definition bslalg_hashtableanchor.h:701
void swap(HashTableAnchor &other)
Definition bslalg_hashtableanchor.h:688
void setListRootAddress(BidirectionalLink *value)
Definition bslalg_hashtableanchor.h:678
HashTableBucket * bucketArrayAddress() const
Definition bslalg_hashtableanchor.h:707
Definition bslma_allocator.h:545
Definition bslma_destructorguard.h:132
Definition bslmf_movableref.h:752
~HashTable_ArrayProctor()
Definition bslstl_hashtable.h:3663
void release()
Definition bslstl_hashtable.h:3682
Definition bslstl_hashtable.h:1763
void swap(HashTable_ComparatorWrapper &other)
Exchange the value of this object with the specified other object.
Definition bslstl_hashtable.h:3545
const FUNCTOR & functor() const
Definition bslstl_hashtable.h:3537
HashTable_ComparatorWrapper()
Definition bslstl_hashtable.h:3513
bool operator()(ARG1_TYPE &arg1, ARG2_TYPE &arg2) const
Definition bslstl_hashtable.h:3530
Definition bslstl_hashtable.h:1632
const FUNCTOR & functor() const
Definition bslstl_hashtable.h:3437
HashTable_HashWrapper()
Definition bslstl_hashtable.h:3414
std::size_t operator()(ARG_TYPE &arg) const
Definition bslstl_hashtable.h:3430
void swap(HashTable_HashWrapper &other)
Exchange the value of this object with the specified other object.
Definition bslstl_hashtable.h:3444
std::size_t hashCodeForKey(DEDUCED_KEY &key) const
Definition bslstl_hashtable.h:3878
HashTable< KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR > HashTableType
Definition bslstl_hashtable.h:3288
NodeFactory & nodeFactory()
Definition bslstl_hashtable.h:3821
void quickSwapRetainAllocators(HashTable_ImplParameters *other)
Definition bslstl_hashtable.h:3845
const BaseComparator & comparator() const
Definition bslstl_hashtable.h:3866
BidirectionalNodePool< typename HashTableType::ValueType, NodeAllocator > NodeFactory
Definition bslstl_hashtable.h:3295
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASHER, LOOKUP_KEY >::value, std::size_t >::type hashCodeForTransparentKey(const LOOKUP_KEY &key) const
Definition bslstl_hashtable.h:3383
const BaseHasher & hasher() const
Definition bslstl_hashtable.h:3889
void quickSwapExchangeAllocators(HashTable_ImplParameters *other)
Definition bslstl_hashtable.h:3829
ReboundTraits::allocator_type NodeAllocator
Definition bslstl_hashtable.h:3291
HashTableType::AllocatorTraits::template rebind_traits< NodeType > ReboundTraits
Definition bslstl_hashtable.h:3290
const HASHER & originalHasher() const
Definition bslstl_hashtable.h:3923
const COMPARATOR & originalComparator() const
Definition bslstl_hashtable.h:3913
~HashTable_NodeProctor()
Definition bslstl_hashtable.h:3629
void release()
Definition bslstl_hashtable.h:3639
Definition bslstl_hashtable.h:1934
bslalg::BidirectionalLink * insertOrAssign(bool *isInsertedFlag, bslalg::BidirectionalLink *hint, BSLS_COMPILERFEATURES_FORWARD_REF(KEY_ARG) key, BDE_OTHER_TYPE &&obj)
Definition bslstl_hashtable.h:4743
bslalg::BidirectionalNode< ValueType > NodeType
Definition bslstl_hashtable.h:1942
HashTable & operator=(const HashTable &rhs)
Definition bslstl_hashtable.h:4418
KEY_CONFIG::KeyType KeyType
Definition bslstl_hashtable.h:1940
void rehashForNumBuckets(SizeType newNumBuckets)
Definition bslstl_hashtable.h:4791
ALLOCATOR AllocatorType
Definition bslstl_hashtable.h:1938
void setMaxLoadFactor(float newMaxLoadFactor)
Definition bslstl_hashtable.h:4878
void swap(HashTable &other)
Definition bslstl_hashtable.h:4901
ALLOCATOR allocator() const
Definition bslstl_hashtable.h:5058
SizeType countElementsInBucket(SizeType index) const
Definition bslstl_hashtable.h:5107
bslalg::BidirectionalLink * tryEmplace(bool *isInsertedFlag, bslalg::BidirectionalLink *hint, const KeyType &key, ARGS &&... args)
Definition bslstl_hashtable.h:4923
SizeType rehashThreshold() const
Definition bslstl_hashtable.h:5386
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASHER, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, bslalg::BidirectionalLink * >::type insertIfMissingTransparent(bool *isInsertedFlag, BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) value)
Definition bslstl_hashtable.h:2413
bslalg::BidirectionalLink * emplaceIfMissing(bool *isInsertedFlag, Args &&... arguments)
::bsl::allocator_traits< AllocatorType > AllocatorTraits
Definition bslstl_hashtable.h:1939
bool hasSameValue(const HashTable &other) const
Definition bslstl_hashtable.h:5179
const COMPARATOR & comparator() const
Definition bslstl_hashtable.h:5099
float maxLoadFactor() const
Definition bslstl_hashtable.h:5344
bslalg::BidirectionalLink * emplace(Args &&... arguments)
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASHER, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, void >::type findRange(bslalg::BidirectionalLink **first, bslalg::BidirectionalLink **last, const LOOKUP_KEY &key) const
Definition bslstl_hashtable.h:2894
bslalg::BidirectionalLink * insert(BSLS_COMPILERFEATURES_FORWARD_REF(SOURCE_TYPE) value)
Definition bslstl_hashtable.h:4721
const HASHER & hasher() const
Definition bslstl_hashtable.h:5328
bslalg::BidirectionalLink * findEndOfRange(bslalg::BidirectionalLink *first) const
Definition bslstl_hashtable.h:5138
bslalg::BidirectionalLink * emplaceWithHint(bslalg::BidirectionalLink *hint, Args &&... arguments)
AllocatorTraits::size_type SizeType
Definition bslstl_hashtable.h:1943
void reserveForNumElements(SizeType numElements)
Definition bslstl_hashtable.h:4852
SizeType maxSize() const
Definition bslstl_hashtable.h:5370
bslalg::BidirectionalLink * remove(bslalg::BidirectionalLink *node)
Definition bslstl_hashtable.h:4813
SizeType numBuckets() const
Return the number of buckets contained in this hash table.
Definition bslstl_hashtable.h:5378
SizeType maxNumBuckets() const
Definition bslstl_hashtable.h:5352
bsl::remove_const< KeyType >::type NonConstKeyType
Definition bslstl_hashtable.h:1944
HashTable(const ALLOCATOR &basicAllocator=ALLOCATOR())
Definition bslstl_hashtable.h:3936
bslalg::BidirectionalLink * insertIfMissing(const KeyType &key)
Definition bslstl_hashtable.h:4619
~HashTable()
Destroy this object.
Definition bslstl_hashtable.h:4085
SizeType bucketIndexForKey(const KeyType &key) const
Definition bslstl_hashtable.h:5077
bslalg::BidirectionalLink * elementListRoot() const
Definition bslstl_hashtable.h:5118
SizeType size() const
Return the number of elements in this hash table.
Definition bslstl_hashtable.h:5394
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASHER, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, bslalg::BidirectionalLink * >::type insertOrAssignTransparent(bool *isInsertedFlag, bslalg::BidirectionalLink *hint, LOOKUP_KEY &&key, BDE_OTHER_TYPE &&obj)
Definition bslstl_hashtable.h:2527
KEY_CONFIG::ValueType ValueType
Definition bslstl_hashtable.h:1941
float loadFactor() const
Definition bslstl_hashtable.h:5335
const bslalg::HashTableBucket & bucketAtIndex(SizeType index) const
Definition bslstl_hashtable.h:5066
void removeAll()
Definition bslstl_hashtable.h:4834
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:231
#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
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
bsl::size_t size(const TYPE &array)
Return the number of elements in the specified array.
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
ALLOCATOR & lhs
Definition bslstl_string.h:3917
BSLS_KEYWORD_CONSTEXPR CONTAINER::value_type * data(CONTAINER &container)
Definition bslstl_iterator.h:1325
Definition baljsn_encoder_testtypes.h:76
Definition bdlbb_blob.h:579
Definition bslstl_algorithm.h:84
void swap(BidirectionalNodePool< VALUE, ALLOCATOR > &a, BidirectionalNodePool< VALUE, ALLOCATOR > &b)
bool operator==(const BidirectionalIterator< T1, ITER_IMP, TAG_TYPE > &lhs, const BidirectionalIterator< T2, ITER_IMP, TAG_TYPE > &rhs)
bool operator!=(const BidirectionalIterator< T1, ITER_IMP, TAG_TYPE > &lhs, const BidirectionalIterator< T2, ITER_IMP, TAG_TYPE > &rhs)
t_TYPE & type
This typedef defines the return type of this meta function.
Definition bslmf_addlvaluereference.h:131
Definition bslma_allocatortraits.h:1089
BloombergLP::bslma::AllocatorTraits_SizeType< ALLOCATOR_TYPE >::type size_type
Definition bslma_allocatortraits.h:1196
Definition bslmf_conditional.h:123
Definition bslmf_enableif.h:530
Definition bslmf_integralconstant.h:261
Definition bslmf_isconvertible.h:875
Definition bslmf_isfunction.h:232
Definition bslmf_ispointer.h:138
t_TYPE type
This typedef is an alias to the (template parameter) t_TYPE.
Definition bslmf_removeconst.h:164
Definition bslalg_hashtablebucket.h:297
Definition bslalg_hashtableimputil.h:615
static void insertAtFrontOfBucket(HashTableAnchor *anchor, BidirectionalLink *link, std::size_t hashCode)
static void remove(HashTableAnchor *anchor, BidirectionalLink *link, std::size_t hashCode)
static void insertAtBackOfBucket(HashTableAnchor *anchor, BidirectionalLink *link, std::size_t hashCode)
static std::size_t computeBucketIndex(std::size_t hashCode, std::size_t numBuckets)
Definition bslalg_hashtableimputil.h:858
static void deallocateObject(const t_ALLOCATOR &allocator, t_POINTER p, std::size_t n=1)
Definition bslma_allocatorutil.h:949
Definition bslmf_movableref.h:795
bsl::conditional< bsl::is_function< CALLABLE >::value, typenamebsl::add_lvalue_reference< CALLABLE >::type, CALLABLE >::type type
Definition bslstl_hashtable.h:1611
static bslma::Allocator * incidentalAllocator()
static bslalg::HashTableBucket * defaultBucketAddress()
static size_t nextPrime(size_t n)
static size_t growBucketsForLoadFactor(size_t *capacity, size_t minElements, size_t requestedBuckets, double maxLoadFactor)
static void destroyBucketArray(bslalg::HashTableBucket *data, std::size_t bucketArraySize, const ALLOCATOR &allocator)
Definition bslstl_hashtable.h:3717
static void initAnchor(bslalg::HashTableAnchor *anchor, std::size_t bucketArraySize, const ALLOCATOR &allocator)
Definition bslstl_hashtable.h:3743
static void assertNotNullPointer(TYPE &)
Definition bslstl_hashtable.h:3693
Definition bsls_objectbuffer.h:277
TYPE * address()
Definition bsls_objectbuffer.h:335
TYPE & object()
Definition bsls_objectbuffer.h:352