mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 11:57:15 +02:00
stylistic
This commit is contained in:
@ -1327,7 +1327,7 @@ public:
|
|||||||
void erase(const_iterator pos)noexcept
|
void erase(const_iterator pos)noexcept
|
||||||
{
|
{
|
||||||
destroy_element(pos.p);
|
destroy_element(pos.p);
|
||||||
reset_slot(pos.pc);
|
recover_slot(pos.pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Key>
|
template<typename Key>
|
||||||
@ -1496,7 +1496,7 @@ private:
|
|||||||
value_type *p;
|
value_type *p;
|
||||||
};
|
};
|
||||||
|
|
||||||
void reset_slot(unsigned char* pc)
|
void recover_slot(unsigned char* pc)
|
||||||
{
|
{
|
||||||
/* If this slot potentially caused overflow, we decrease the maximum load so
|
/* If this slot potentially caused overflow, we decrease the maximum load so
|
||||||
* that average probe length won't increase unboundedly in repeated
|
* that average probe length won't increase unboundedly in repeated
|
||||||
@ -1507,9 +1507,9 @@ private:
|
|||||||
--size_;
|
--size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_slot(group_type* pg,std::size_t pos)
|
void recover_slot(group_type* pg,std::size_t pos)
|
||||||
{
|
{
|
||||||
reset_slot(reinterpret_cast<unsigned char*>(pg)+pos);
|
recover_slot(reinterpret_cast<unsigned char*>(pg)+pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t max_load()const
|
std::size_t max_load()const
|
||||||
@ -1651,8 +1651,8 @@ private:
|
|||||||
BOOST_NOINLINE iterator
|
BOOST_NOINLINE iterator
|
||||||
unchecked_emplace_with_rehash(std::size_t hash,Args&&... args)
|
unchecked_emplace_with_rehash(std::size_t hash,Args&&... args)
|
||||||
{
|
{
|
||||||
/* Due to the anti-drift mechanism (see reset_slot), new_arrays_ may be of
|
/* Due to the anti-drift mechanism (see recover_slot), new_arrays_ may be
|
||||||
* the same size as the old arrays; in the limit, erasing one element at
|
* of the same size as the old arrays; in the limit, erasing one element at
|
||||||
* full load and then inserting could bring us back to the same capacity
|
* full load and then inserting could bring us back to the same capacity
|
||||||
* after a costly rehash. We introduce a 10% level of hysteresis to avoid
|
* after a costly rehash. We introduce a 10% level of hysteresis to avoid
|
||||||
* that (the size_/10 addendum).
|
* that (the size_/10 addendum).
|
||||||
@ -1698,7 +1698,7 @@ private:
|
|||||||
auto mask=pg->match_occupied();
|
auto mask=pg->match_occupied();
|
||||||
while(mask){
|
while(mask){
|
||||||
auto nz=unchecked_countr_zero(mask);
|
auto nz=unchecked_countr_zero(mask);
|
||||||
reset_slot(pg,nz);
|
recover_slot(pg,nz);
|
||||||
if(!(--num_destroyed))goto continue_;
|
if(!(--num_destroyed))goto continue_;
|
||||||
mask&=mask-1;
|
mask&=mask-1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user