forked from boostorg/unordered
implemented safe concurrent_table::load_factor
This commit is contained in:
committed by
Christian Mazakas
parent
c5debf11cf
commit
0d1fdae84c
@ -311,9 +311,7 @@ public:
|
||||
std::size_t size()const noexcept
|
||||
{
|
||||
auto lck=shared_access();
|
||||
std::size_t ml_=this->ml;
|
||||
std::size_t size_=this->size_;
|
||||
return size_<=ml_?size_:ml_;
|
||||
return unprotected_size();
|
||||
}
|
||||
|
||||
using super::max_size;
|
||||
@ -485,7 +483,9 @@ public:
|
||||
float load_factor()const noexcept
|
||||
{
|
||||
auto lck=shared_access();
|
||||
return super::load_factor();
|
||||
if(super::capacity()==0)return 0;
|
||||
else return float(unprotected_size())/
|
||||
float(super::capacity());
|
||||
}
|
||||
|
||||
using super::max_load_factor;
|
||||
@ -568,6 +568,13 @@ private:
|
||||
return this->arrays.groups[pos].insert_counter();
|
||||
}
|
||||
|
||||
std::size_t unprotected_size()const
|
||||
{
|
||||
std::size_t ml_=this->ml;
|
||||
std::size_t size_=this->size_;
|
||||
return size_<=ml_?size_:ml_;
|
||||
}
|
||||
|
||||
struct erase_on_exit
|
||||
{
|
||||
erase_on_exit(
|
||||
|
Reference in New Issue
Block a user