8#ifndef INCLUDED_BSLSTL_HASHTABLE
9#define INCLUDED_BSLSTL_HASHTABLE
1491#include <bslscm_version.h>
1531#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
1536#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
1540#if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
1546# define COMPILING_BSLSTL_HASHTABLE_H
1548# undef COMPILING_BSLSTL_HASHTABLE_H
1557template <
class KEY_CONFIG,
1563template <
class FACTORY>
1564class HashTable_ArrayProctor;
1566template <
class FACTORY>
1567class HashTable_NodeProctor;
1569template <
class FUNCTOR>
1570class HashTable_ComparatorWrapper;
1572template <
class FUNCTOR>
1573class HashTable_ComparatorWrapper<const FUNCTOR>;
1575template <
class FUNCTOR>
1576class HashTable_ComparatorWrapper<FUNCTOR &>;
1578template <
class FUNCTOR>
1579class HashTable_HashWrapper;
1581template <
class FUNCTOR>
1582class HashTable_HashWrapper<const FUNCTOR>;
1584template <
class FUNCTOR>
1585class HashTable_HashWrapper<FUNCTOR &>;
1587struct HashTable_ImpDetails;
1588struct HashTable_Util;
1604template <
class CALLABLE>
1631template <
class FUNCTOR>
1635 mutable FUNCTOR d_functor;
1659 template <
class ARG_TYPE>
1664 const FUNCTOR&
functor()
const;
1676template <
class FUNCTOR>
1680 const FUNCTOR d_functor;
1699 template <
class ARG_TYPE>
1717template <
class FUNCTOR>
1736 template <
class ARG_TYPE>
1737 std::size_t operator()(ARG_TYPE& arg)
const;
1741 FUNCTOR& functor()
const;
1746template <
class FUNCTOR>
1762template <
class FUNCTOR>
1766 mutable FUNCTOR d_functor;
1790 template <
class ARG1_TYPE,
class ARG2_TYPE>
1791 bool operator()(ARG1_TYPE& arg1, ARG2_TYPE& arg2)
const;
1795 const FUNCTOR&
functor()
const;
1807template <
class FUNCTOR>
1811 const FUNCTOR d_functor;
1830 template <
class ARG1_TYPE,
class ARG2_TYPE>
1848template <
class FUNCTOR>
1867 template <
class ARG1_TYPE,
class ARG2_TYPE>
1868 bool operator()(ARG1_TYPE& arg1, ARG2_TYPE& arg2)
const;
1872 FUNCTOR& functor()
const;
1877template <
class FUNCTOR>
1885template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
1933template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
1962 typedef typename AllocatorTraits::template rebind_traits<NodeType>
1966 ReboundTraits::propagate_on_container_copy_assignment::value ==
1967 AllocatorTraits::propagate_on_container_copy_assignment::value);
1970 ReboundTraits::propagate_on_container_move_assignment::value ==
1971 AllocatorTraits::propagate_on_container_move_assignment::value);
1973 BSLMF_ASSERT(ReboundTraits::propagate_on_container_swap::value ==
1974 AllocatorTraits::propagate_on_container_swap::value);
1978 ImplParameters d_parameters;
1985 float d_maxLoadFactor;
2023 void quickSwapExchangeAllocators(
HashTable *other);
2030 void quickSwapRetainAllocators(
HashTable *other);
2046 void rehashIntoExactlyNumBuckets(
SizeType newNumBuckets,
2055 void removeAllAndDeallocate();
2065 void removeAllImp();
2079 template <
class DEDUCED_KEY>
2081 std::size_t hashValue)
const;
2113 explicit HashTable(
const ALLOCATOR& basicAllocator = ALLOCATOR());
2136 const COMPARATOR& compare,
2138 float initialMaxLoadFactor,
2139 const ALLOCATOR& basicAllocator = ALLOCATOR());
2166 HashTable(BloombergLP::bslmf::MovableRef<HashTable> original);
2198 HashTable(BloombergLP::bslmf::MovableRef<HashTable> original,
2199 const ALLOCATOR& basicAllocator);
2239#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
2254 template <
class... Args>
2278 template <
class... Args>
2281 Args&&... arguments);
2302 template <
class... Args>
2304 Args&&... arguments);
2343 bool *isInsertedFlag,
2362 bool *isInsertedFlag,
2383 template <
class SOURCE_TYPE>
2386 bool *isInsertedFlag,
2389#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
2408 template <
class LOOKUP_KEY>
2410 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2411 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value
2414 bool *isInsertedFlag,
2421 const LOOKUP_KEY& lvalue = value;
2423 size_t hashCode = this->d_parameters.hashCodeForTransparentKey(lvalue);
2426 bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2429 d_parameters.comparator(),
2432 *isInsertedFlag = (!position);
2435 if (d_size >= d_capacity) {
2439 position = d_parameters.nodeFactory().emplaceIntoNewNode(
2468 template <
class SOURCE_TYPE>
2493 template <
class SOURCE_TYPE>
2498#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
2507 template <
class KEY_ARG,
class BDE_OTHER_TYPE>
2509 bool *isInsertedFlag,
2512 BDE_OTHER_TYPE&& obj);
2522 template <
class LOOKUP_KEY,
class BDE_OTHER_TYPE>
2524 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2525 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value
2530 BDE_OTHER_TYPE&& obj)
2536 size_t hashCode = this->d_parameters.hashCodeForTransparentKey(key);
2539 || !d_parameters.comparator()(key,
2540 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2541 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2544 d_parameters.comparator(),
2549 static_cast<NodeType *
>(hint)->value().second =
2551 *isInsertedFlag =
false;
2556 if (d_size >= d_capacity) {
2561 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2567 nodeProctor(&d_parameters.nodeFactory(), hint);
2568 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2572 *isInsertedFlag =
true;
2651#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
2660 template <
class... ARGS>
2662 bool *isInsertedFlag,
2675 template <
class... ARGS>
2677 bool *isInsertedFlag,
2691 template <
class LOOKUP_KEY,
class... ARGS>
2693 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2694 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2696 bool *isInsertedFlag,
2705 const std::size_t hashCode =
2706 this->d_parameters.hashCodeForTransparentKey(key);
2710 || !d_parameters.comparator()(
2712 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
2714 hint = bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2717 d_parameters.comparator(),
2723 *isInsertedFlag =
false;
2727 if (d_size >= d_capacity) {
2732 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2733 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2734 std::piecewise_construct,
2738 typedef typename ValueType::second_type MappedType;
2746 AllocatorTraits::construct(alloc, defaultMapped.
address(),
2750 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
2757 nodeProctor(&d_parameters.nodeFactory(), hint);
2758 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
2762 *isInsertedFlag =
true;
2790 template <
class LOOKUP_KEY>
2792 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2793 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2810 size_t hashCode = this->d_parameters.hashCodeForKey(key);
2839 template <
class LOOKUP_KEY>
2841 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2842 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2848 return bslalg::HashTableImpUtil::findTransparent<KEY_CONFIG>(
2851 d_parameters.comparator(),
2852 d_parameters.hashCodeForKey(key));
2889 template <
class LOOKUP_KEY>
2891 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value
2892 && BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,LOOKUP_KEY>::value,
2896 const LOOKUP_KEY& key)
const
2903 *first = this->find(key);
2942 const HASHER&
hasher()
const;
2999template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3017template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3037template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3049template <
class FACTORY>
3054 FACTORY *d_factory_p;
3099template <
class FACTORY>
3104 FACTORY *d_factory_p;
3163 size_t requestedBuckets,
3164 double maxLoadFactor);
3209 template <
class TYPE>
3211 template <
class TYPE>
3213 template <
class TYPE>
3218 template<
class ALLOCATOR>
3220 std::size_t bucketArraySize,
3221 const ALLOCATOR& allocator);
3230 template<
class ALLOCATOR>
3232 std::size_t bucketArraySize,
3233 const ALLOCATOR& allocator);
3248template <
class HASHER>
3251 typename CallableVariable<HASHER>::type> >
3255template <
class COMPARATOR>
3258 typename CallableVariable<COMPARATOR>::type> >
3266template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3281 typedef ALLOCATOR AllocatorType;
3282 typedef ::bsl::allocator_traits<AllocatorType> AllocatorTraits;
3283 typedef typename KEY_CONFIG::ValueType ValueType;
3289 typedef typename HashTableType::AllocatorTraits::
3322 const COMPARATOR& compare,
3323 const ALLOCATOR& allocator);
3329 const ALLOCATOR& allocator);
3370 template <
class DEDUCED_KEY>
3379 template <
class LOOKUP_KEY>
3381 BloombergLP::bslmf::IsTransparentPredicate<HASHER, LOOKUP_KEY>::value,
3389 const BaseHasher&
hasher()
const;
3412template <
class FUNCTOR>
3419template <
class FUNCTOR>
3426template <
class FUNCTOR>
3427template <
class ARG_TYPE>
3432 return d_functor(arg);
3435template <
class FUNCTOR>
3442template <
class FUNCTOR>
3447 swap(d_functor, other.d_functor);
3452template <
class FUNCTOR>
3459template <
class FUNCTOR>
3466template <
class FUNCTOR>
3467template <
class ARG_TYPE>
3472 return d_functor(arg);
3475template <
class FUNCTOR>
3484template <
class FUNCTOR>
3491template <
class FUNCTOR>
3492template <
class ARG_TYPE>
3497 return d_functor(arg);
3500template <
class FUNCTOR>
3511template <
class FUNCTOR>
3518template <
class FUNCTOR>
3526template <
class FUNCTOR>
3527template <
class ARG1_TYPE,
class ARG2_TYPE>
3531 ARG2_TYPE& arg2)
const
3533 return d_functor(arg1, arg2);
3536template <
class FUNCTOR>
3542template <
class FUNCTOR>
3548 swap(d_functor, other.d_functor);
3553template <
class FUNCTOR>
3560template <
class FUNCTOR>
3568template <
class FUNCTOR>
3569template <
class ARG1_TYPE,
class ARG2_TYPE>
3573 ARG2_TYPE& arg2)
const
3575 return d_functor(arg1, arg2);
3578template <
class FUNCTOR>
3586template <
class FUNCTOR>
3594template <
class FUNCTOR>
3595template <
class ARG1_TYPE,
class ARG2_TYPE>
3599 ARG2_TYPE& arg2)
const
3601 return d_functor(arg1, arg2);
3604template <
class FUNCTOR>
3616template <
class FACTORY>
3621: d_factory_p(factory)
3627template <
class FACTORY>
3632 d_factory_p->deleteNode(d_node_p);
3637template <
class FACTORY>
3649template <
class FACTORY>
3654: d_factory_p(factory)
3661template <
class FACTORY>
3667 d_anchor_p->bucketArraySize(),
3668 d_factory_p->allocator());
3673 d_factory_p->deleteNode(root);
3680template <
class FACTORY>
3691template <
class TYPE>
3697template <
class TYPE>
3706template <
class TYPE>
3715template <
class ALLOCATOR>
3719 std::size_t bucketArraySize,
3720 const ALLOCATOR& allocator)
3724 (1 < bucketArraySize
3726 || (1 == bucketArraySize
3729#ifdef BSLS_ASSERT_SAFE_IS_ACTIVE
3732 bucketArraySize <= std::numeric_limits<AllocSizeType>::max());
3741template <
class ALLOCATOR>
3744 std::size_t bucketArraySize,
3745 const ALLOCATOR& allocator)
3750#ifdef BSLS_ASSERT_SAFE_IS_ACTIVE
3753 bucketArraySize <= std::numeric_limits<AllocSizeType>::max());
3757 Bucket *data = bslma::AllocatorUtil::allocateObject<Bucket>(allocator,
3760 std::fill_n(data, bucketArraySize, Bucket());
3770template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3776, d_nodeFactory(allocator)
3780template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3784 const COMPARATOR& compare,
3785 const ALLOCATOR& allocator)
3787, BaseComparator(compare)
3788, d_nodeFactory(allocator)
3792template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3796 const ALLOCATOR& allocator)
3797: BaseHasher(static_cast<const BaseHasher&>(original))
3798, BaseComparator(static_cast<const BaseComparator&>(original))
3799, d_nodeFactory(allocator)
3803template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3807: BaseHasher(static_cast<const BaseHasher&>(original))
3808, BaseComparator(static_cast<const BaseComparator&>(original))
3814template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3819 ALLOCATOR>::NodeFactory &
3823 return d_nodeFactory;
3826template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3834 swap(*
static_cast<BaseHasher*
>(
this), *
static_cast<BaseHasher*
>(other));
3836 swap(*
static_cast<BaseComparator*
>(
this),
3837 *
static_cast<BaseComparator*
>(other));
3839 nodeFactory().swapExchangeAllocators(other->
nodeFactory());
3842template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3850 swap(*
static_cast<BaseHasher*
>(
this), *
static_cast<BaseHasher*
>(other));
3852 swap(*
static_cast<BaseComparator*
>(
this),
3853 *
static_cast<BaseComparator*
>(other));
3855 nodeFactory().swapRetainAllocators(other->
nodeFactory());
3859template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3864 ALLOCATOR>::BaseComparator &
3871template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3872template <
class DEDUCED_KEY>
3878hashCodeForKey(DEDUCED_KEY& key)
const
3880 return static_cast<const BaseHasher &
>(*this)(key);
3883template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3888 ALLOCATOR>::BaseHasher &
3895template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3900 ALLOCATOR>::NodeFactory &
3904 return d_nodeFactory;
3907template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3913 ALLOCATOR>::originalComparator()
const
3915 return static_cast<const BaseComparator *
>(
this)->functor();
3918template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3923 ALLOCATOR>::originalHasher()
const
3925 return static_cast<const BaseHasher *
>(
this)->functor();
3933template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3936HashTable(
const ALLOCATOR& basicAllocator)
3937: d_parameters(basicAllocator)
3941, d_maxLoadFactor(1.0)
3947template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3951 const COMPARATOR& compare,
3953 float initialMaxLoadFactor,
3954 const ALLOCATOR& basicAllocator)
3955: d_parameters(hash, compare, basicAllocator)
3959, d_maxLoadFactor(initialMaxLoadFactor)
3970 if (0 != initialNumBuckets) {
3975 static_cast<size_t>(initialNumBuckets),
3978 d_capacity =
static_cast<SizeType>(capacity);
3982template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
3987 original.d_parameters,
3988 AllocatorTraits::select_on_container_copy_construction(original.allocator()))
3990, d_size(original.d_size)
3992, d_maxLoadFactor(original.d_maxLoadFactor)
3995 d_parameters.nodeFactory().reserveNodes(original.d_size);
4000template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4003 BloombergLP::bslmf::MovableRef<HashTable> original)
4008, d_maxLoadFactor(1.0)
4012 swap(d_anchor, lvalue.d_anchor);
4013 swap(d_size, lvalue.d_size);
4014 swap(d_capacity, lvalue.d_capacity);
4015 swap(d_maxLoadFactor, lvalue.d_maxLoadFactor);
4018template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4022: d_parameters(original.d_parameters, basicAllocator)
4024, d_size(original.d_size)
4026, d_maxLoadFactor(original.d_maxLoadFactor)
4029 d_parameters.nodeFactory().reserveNodes(original.d_size);
4034template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4037 const ALLOCATOR& basicAllocator)
4038: d_parameters(MoveUtil::access(original).d_parameters.originalHasher(),
4039 MoveUtil::access(original).d_parameters.originalComparator(),
4044, d_maxLoadFactor(1.0)
4048 basicAllocator == lvalue.
allocator())) {
4049 d_parameters.nodeFactory().adopt(
4052 swap(d_anchor, lvalue.d_anchor);
4053 swap(d_size, lvalue.d_size);
4054 swap(d_capacity, lvalue.d_capacity);
4055 swap(d_maxLoadFactor, lvalue.d_maxLoadFactor);
4058 d_size = lvalue.d_size;
4059 d_maxLoadFactor = lvalue.d_maxLoadFactor;
4065 swap(anchor, lvalue.d_anchor);
4068 lvalue.d_capacity = 0;
4069 lvalue.d_maxLoadFactor = 1.0f;
4071 HashTable_ArrayProctor<typename ImplParameters::NodeFactory>
4072 arrayProctor(&lvalue.d_parameters.nodeFactory(),
4075 d_parameters.nodeFactory().reserveNodes(d_size);
4076 this->moveDataStructure(anchor.listRootAddress());
4083template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4087#if defined(BDE_BUILD_TARGET_SAFE_2)
4100 this->d_parameters.hasher(),
4104 this->removeAllAndDeallocate();
4108template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4125 static_cast<size_t>(d_size),
4135 arrayProctor(&d_parameters.nodeFactory(), &d_anchor);
4137 d_capacity =
static_cast<SizeType
>(capacity);
4145 size_t hashCode = this->hashCodeForNode(cursor);
4147 d_parameters.nodeFactory().cloneNode(*cursor);
4153 while (0 != (cursor = cursor->
nextLink()));
4157 arrayProctor.release();
4160template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4162HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::moveDataStructure(
4177 static_cast<size_t>(d_size),
4184 d_capacity =
static_cast<SizeType
>(capacity);
4188 HashTable_ArrayProctor<typename ImplParameters::NodeFactory>
4189 arrayProctor(&d_parameters.nodeFactory(), &d_anchor);
4197 size_t hashCode = this->hashCodeForNode(cursor);
4199 d_parameters.nodeFactory().moveIntoNewNode(cursor);
4205 while (0 != (cursor = cursor->
nextLink()));
4209 arrayProctor.release();
4212template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4214HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4215quickSwapExchangeAllocators(HashTable *other)
4219 d_parameters.quickSwapExchangeAllocators(&other->d_parameters);
4222 swap(d_anchor, other->d_anchor);
4223 swap(d_size, other->d_size);
4224 swap(d_capacity, other->d_capacity);
4225 swap(d_maxLoadFactor, other->d_maxLoadFactor);
4228template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4230HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4231quickSwapRetainAllocators(HashTable *other)
4236 d_parameters.quickSwapRetainAllocators(&other->d_parameters);
4239 swap(d_anchor, other->d_anchor);
4240 swap(d_size, other->d_size);
4241 swap(d_capacity, other->d_capacity);
4242 swap(d_maxLoadFactor, other->d_maxLoadFactor);
4245template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4247HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::
4248rehashIntoExactlyNumBuckets(SizeType newNumBuckets, SizeType capacity)
4261 HashTable *d_table_p;
4265#if !defined(BSLS_PLATFORM_CMP_MSVC)
4270 Proctor(
const Proctor&);
4271 Proctor& operator=(
const Proctor&);
4276 Proctor(HashTable *table,
4280 , d_originalAnchor_p(originalAnchor)
4281 , d_newAnchor_p(newAnchor)
4290 if (d_originalAnchor_p) {
4296 d_table_p->removeAll();
4303 HashTable_Util::destroyBucketArray(
4306 d_table_p->allocator());
4312 d_originalAnchor_p = 0;
4325 static_cast<size_t>(newNumBuckets),
4328 Proctor cleanUpIfUserHashThrows(
this, &d_anchor, &newAnchor);
4331 bslalg::HashTableImpUtil::rehash<KEY_CONFIG>(
4334 this->d_parameters.hasher());
4337 cleanUpIfUserHashThrows.dismiss();
4339 d_anchor.
swap(newAnchor);
4340 d_capacity = capacity;
4343template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4346HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::removeAllAndDeallocate()
4348 this->removeAllImp();
4354template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4356HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::removeAllImp()
4365 BidirectionalLink *next;
4368 d_parameters.nodeFactory().deleteNode(
4369 static_cast<NodeType *
>(root));
4371 while(0 != (root = next));
4376template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4377template <
class DEDUCED_KEY>
4380HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::find(
4382 std::size_t hashValue)
const
4384 return bslalg::HashTableImpUtil::find<KEY_CONFIG>(
4387 d_parameters.comparator(),
4391template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4394HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::getBucketAddress(
4395 SizeType bucketIndex)
const
4402template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4405HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>::hashCodeForNode(
4410 return d_parameters.hashCodeForKey(
4411 bslalg::HashTableImpUtil::extractKey<KEY_CONFIG>(node));
4415template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4417HashTable<KEY_CONFIG, HASHER, COMPARATOR, ALLOCATOR>&
4423 if (AllocatorTraits::propagate_on_container_copy_assignment::value) {
4425 quickSwapExchangeAllocators(&other);
4428 HashTable other(rhs, this->allocator());
4429 quickSwapRetainAllocators(&other);
4435template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4443 if (allocator() == lvalue.
allocator()) {
4444 HashTable other(MoveUtil::move(lvalue));
4445 quickSwapRetainAllocators(&other);
4448 AllocatorTraits::propagate_on_container_move_assignment::value) {
4449 HashTable other(MoveUtil::move(lvalue));
4450 quickSwapExchangeAllocators(&other);
4453 HashTable other(MoveUtil::move(lvalue), allocator());
4454 quickSwapRetainAllocators(&other);
4460#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
4461template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4462template <
class... ARGS>
4465 ARGS&&... arguments)
4472 if (d_size >= d_capacity) {
4473 this->rehashForNumBuckets(numBuckets() * 2);
4479 d_parameters.nodeFactory().emplaceIntoNewNode(
4486 nodeProctor(&d_parameters.nodeFactory(), newNode);
4491 size_t hashCode = this->d_parameters.hashCodeForKey(
4492 ImpUtil::extractKey<KEY_CONFIG>(newNode));
4494 ImpUtil::extractKey<KEY_CONFIG>(newNode),
4498 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
4501 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, position);
4510template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4511template <
class... ARGS>
4515 ARGS&&... arguments)
4522 if (d_size >= d_capacity) {
4523 this->rehashForNumBuckets(numBuckets() * 2);
4529 d_parameters.nodeFactory().emplaceIntoNewNode(
4536 nodeProctor(&d_parameters.nodeFactory(), newNode);
4540 size_t hashCode = this->d_parameters.hashCodeForKey(
4541 ImpUtil::extractKey<KEY_CONFIG>(newNode));
4543 || !d_parameters.comparator()(ImpUtil::extractKey<KEY_CONFIG>(newNode),
4544 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
4545 hint = this->find(ImpUtil::extractKey<KEY_CONFIG>(newNode), hashCode);
4549 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
4552 ImpUtil::insertAtPosition(&d_anchor, newNode, hashCode, hint);
4561template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4562template <
class... ARGS>
4565 bool *isInsertedFlag,
4566 ARGS&&... arguments)
4575 if (d_size >= d_capacity) {
4576 this->rehashForNumBuckets(numBuckets() * 2);
4582 d_parameters.nodeFactory().emplaceIntoNewNode(
4589 nodeProctor(&d_parameters.nodeFactory(), newNode);
4593 size_t hashCode = this->d_parameters.hashCodeForKey(
4594 ImpUtil::extractKey<KEY_CONFIG>(newNode));
4596 ImpUtil::extractKey<KEY_CONFIG>(newNode),
4599 *isInsertedFlag = (!position);
4602 if (d_size >= d_capacity) {
4603 this->rehashForNumBuckets(numBuckets() * 2);
4606 ImpUtil::insertAtFrontOfBucket(&d_anchor, newNode, hashCode);
4617template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4626template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4632 return tryEmplace(&dummy,
4634 MoveUtil::move(key));
4637template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4640 bool *isInsertedFlag,
4645 size_t hashCode = this->d_parameters.hashCodeForKey(
4646 KEY_CONFIG::extractKey(value));
4648 KEY_CONFIG::extractKey(value),
4651 *isInsertedFlag = (!position);
4654 if (d_size >= d_capacity) {
4655 this->rehashForNumBuckets(numBuckets() * 2);
4658 position = d_parameters.nodeFactory().emplaceIntoNewNode(value);
4668template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4671 bool *isInsertedFlag,
4678 size_t hashCode = this->d_parameters.hashCodeForKey(
4679 KEY_CONFIG::extractKey(lvalue));
4681 KEY_CONFIG::extractKey(lvalue),
4684 *isInsertedFlag = (!position);
4687 if (d_size >= d_capacity) {
4688 this->rehashForNumBuckets(numBuckets() * 2);
4691 position = d_parameters.nodeFactory().emplaceIntoNewNode(
4692 MoveUtil::move(lvalue));
4702template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4703template <
class SOURCE_TYPE>
4707 bool *isInsertedFlag,
4712 return emplaceIfMissing(isInsertedFlag,
4717template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4718template <
class SOURCE_TYPE>
4727template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4728template <
class SOURCE_TYPE>
4735 return emplaceWithHint(hint,
4739#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
4740template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4741template <
class KEY_ARG,
class BDE_OTHER_TYPE>
4744 bool *isInsertedFlag,
4747 BDE_OTHER_TYPE&& obj)
4751 const KEY_ARG& lvalue = key;
4752 size_t hashCode = this->d_parameters.hashCodeForKey(lvalue);
4755 || !d_parameters.comparator()(lvalue,
4756 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
4757 hint = this->find(lvalue, hashCode);
4761 static_cast<NodeType *
>(hint)->value().second =
4763 *isInsertedFlag =
false;
4768 if (d_size >= d_capacity) {
4769 this->rehashForNumBuckets(numBuckets() * 2);
4773 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
4779 nodeProctor(&d_parameters.nodeFactory(), hint);
4780 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
4784 *isInsertedFlag =
true;
4789template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4794 if (newNumBuckets > this->numBuckets()) {
4803 static_cast<size_t>(newNumBuckets),
4806 this->rehashIntoExactlyNumBuckets(numBuckets,
4811template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4824 hashCodeForNode(node));
4827 d_parameters.nodeFactory().deleteNode(
static_cast<NodeType *
>(node));
4832template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4836 this->removeAllImp();
4849template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4855 if (numElements < 1) {
4859 if (numElements > d_capacity) {
4868 static_cast<size_t>(this->numBuckets()),
4871 this->rehashIntoExactlyNumBuckets(numBuckets,
4876template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4879 float newMaxLoadFactor)
4887 std::max<SizeType>(d_size, 1u),
4888 static_cast<size_t>(this->numBuckets()),
4891 this->rehashIntoExactlyNumBuckets(numBuckets,
4896 d_maxLoadFactor = newMaxLoadFactor;
4899template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4905 if (AllocatorTraits::propagate_on_container_swap::value) {
4906 quickSwapExchangeAllocators(&other);
4912 BSLS_ASSERT(d_parameters.nodeFactory().allocator() ==
4913 other.d_parameters.nodeFactory().allocator());
4914 quickSwapRetainAllocators(&other);
4918#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
4919template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4920template <
class... ARGS>
4924 bool *isInsertedFlag,
4931 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
4935 || !d_parameters.comparator()(key,
4936 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
4937 hint = this->find(key, hashCode);
4942 *isInsertedFlag =
false;
4946 if (d_size >= d_capacity) {
4947 this->rehashForNumBuckets(numBuckets() * 2);
4951#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
4952 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
4953 std::piecewise_construct,
4954 std::forward_as_tuple(key),
4955 std::forward_as_tuple(std::forward<ARGS>(args)...));
4957 typedef typename ValueType::second_type MappedType;
4965 AllocatorTraits::construct(alloc, defaultMapped.
address(),
4966 std::forward<ARGS>(args)...);
4969 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
4976 nodeProctor(&d_parameters.nodeFactory(), hint);
4977 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
4981 *isInsertedFlag =
true;
4986template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
4987template <
class... ARGS>
4991 bool *isInsertedFlag,
4999 const size_t hashCode = this->d_parameters.hashCodeForKey(key);
5003 || !d_parameters.comparator()(lvalue,
5004 ImpUtil::extractKey<KEY_CONFIG>(hint))) {
5005 hint = this->find(lvalue, hashCode);
5010 *isInsertedFlag =
false;
5014 if (d_size >= d_capacity) {
5015 this->rehashForNumBuckets(numBuckets() * 2);
5019#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
5020 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
5021 std::piecewise_construct,
5022 std::forward_as_tuple(MoveUtil::move(key)),
5023 std::forward_as_tuple(std::forward<ARGS>(args)...));
5025 typedef typename ValueType::second_type MappedType;
5033 AllocatorTraits::construct(alloc, defaultMapped.
address(),
5034 std::forward<ARGS>(args)...);
5037 hint = d_parameters.nodeFactory().emplaceIntoNewNode(
5038 MoveUtil::move(key),
5044 nodeProctor(&d_parameters.nodeFactory(), hint);
5045 ImpUtil::insertAtFrontOfBucket(&d_anchor, hint, hashCode);
5049 *isInsertedFlag =
true;
5055template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5060 return d_parameters.nodeFactory().allocator();
5063template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5074template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5090 size_t hashCode = this->d_parameters.hashCodeForKey(key);
5096template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5104template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5112 return static_cast<SizeType>(bucketAtIndex(index).countElements());
5115template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5123template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5129 return bslalg::HashTableImpUtil::find<KEY_CONFIG>(
5132 d_parameters.comparator(),
5133 d_parameters.hashCodeForKey(key));
5136template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5152 KeyRef k = ImpUtil::extractKey<KEY_CONFIG>(first);
5154 while (0 != (first = first->
nextLink()) &&
5155 d_parameters.comparator()(k,ImpUtil::extractKey<KEY_CONFIG>(first)))
5162template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5173 *first = this->find(key);
5174 *last = *first ? this->findEndOfRange(*first) : 0;
5177template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5194 typedef typename KEY_CONFIG::ValueType
ValueType;
5195 typedef typename ::bsl::allocator_traits<ALLOCATOR>::size_type
SizeType;
5200 if (this->size() != other.
size()) {
5210 ImpUtil::find<KEY_CONFIG>(other.d_anchor,
5211 ImpUtil::extractKey<KEY_CONFIG>(cursor),
5212 other.d_parameters.comparator(),
5213 other.d_parameters.hashCodeForKey(
5214 ImpUtil::extractKey<KEY_CONFIG>(cursor)));
5227 while (endWalker != endRange) {
5229 if (rhsWalker == rhsLast) {
5236 if (rhsWalker != rhsLast) {
5245 while (cursor != endRange &&
5246 (ImpUtil::extractValue<KEY_CONFIG>(cursor) ==
5247 ImpUtil::extractValue<KEY_CONFIG>(rhsFirst)))
5253 if (cursor == endRange) {
5275 ImpUtil::extractValue<KEY_CONFIG>(marker);
5277 if (cursor != marker) {
5281 while (scanner != marker &&
5282 ImpUtil::extractValue<KEY_CONFIG>(scanner) != valueAtMarker) {
5285 if (scanner != marker) {
5294 if (ImpUtil::extractValue<KEY_CONFIG>(scanner) ==
5306 scanner != endRange;
5309 if (ImpUtil::extractValue<KEY_CONFIG>(scanner) ==
5325template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5333template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5337 return static_cast<float>(
static_cast<double>(this->size())
5338 /
static_cast<double>(this->numBuckets()));
5341template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5346 return d_maxLoadFactor;
5349template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5359 typedef typename AllocatorTraits::
5360 template rebind_traits<bslalg::HashTableBucket>
5361 BucketAllocatorTraits;
5362 typedef typename BucketAllocatorTraits::allocator_type BucketAllocator;
5364 return BucketAllocatorTraits::max_size(BucketAllocator(this->allocator()));
5367template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5372 return AllocatorTraits::max_size(this->allocator()) /
sizeof(
NodeType);
5375template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5383template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5391template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5405template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5430template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5436 return lhs.hasSameValue(rhs);
5439template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5448template <
class FUNCTOR>
5456template <
class FUNCTOR>
5476template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5484template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5496template <
class KEY_CONFIG,
class HASHER,
class COMPARATOR,
class ALLOCATOR>
5502 && bslmf::IsBitwiseMoveable<COMPARATOR>::value
5503 && bslmf::IsBitwiseMoveable<ALLOCATOR>::value>
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
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
Definition bslstl_bidirectionalnodepool.h:274
Definition bslstl_hashtable.h:3050
~HashTable_ArrayProctor()
Definition bslstl_hashtable.h:3663
void release()
Definition bslstl_hashtable.h:3682
const FUNCTOR & functor() const
HashTable_ComparatorWrapper(const FUNCTOR &fn)
bool operator()(ARG1_TYPE &arg1, ARG2_TYPE &arg2) const
HashTable_ComparatorWrapper()
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
HashTable_HashWrapper(const FUNCTOR &fn)
const FUNCTOR & functor() const
std::size_t operator()(ARG_TYPE &arg) const
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
Definition bslstl_hashtable.h:3270
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
Definition bslstl_hashtable.h:3100
~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
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASHER, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, bslalg::BidirectionalLink * >::type tryEmplace(bool *isInsertedFlag, bslalg::BidirectionalLink *hint, LOOKUP_KEY &&key, ARGS &&... args)
Definition bslstl_hashtable.h:2695
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
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASHER, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, bslalg::BidirectionalLink * >::type find(const LOOKUP_KEY &key) const
Definition bslstl_hashtable.h:2844
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)
HashTable & operator=(BloombergLP::bslmf::MovableRef< HashTable > rhs)
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
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASHER, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, SizeType >::type bucketIndexForKey(const LOOKUP_KEY &key) const
Definition bslstl_hashtable.h:2795
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
HashTable(BloombergLP::bslmf::MovableRef< HashTable > original, const ALLOCATOR &basicAllocator)
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
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
void swap(OptionValue &a, OptionValue &b)
ALLOCATOR & lhs
Definition bslstl_string.h:3917
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 bslma_usesbslmaallocator.h:344
Definition bslmf_isbitwisemoveable.h:718
Definition bslmf_movableref.h:795
static MovableRef< t_TYPE > move(t_TYPE &reference) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1067
Definition bslstl_hashtable.h:1605
bsl::conditional< bsl::is_function< CALLABLE >::value, typenamebsl::add_lvalue_reference< CALLABLE >::type, CALLABLE >::type type
Definition bslstl_hashtable.h:1611
Definition bslstl_hashtable.h:3252
Definition bslstl_hashtable.h:3259
Definition bslstl_hashtable.h:3144
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)
Definition bslstl_hashtable.h:3198
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