Expand calls to load_factor implementation

This commit is contained in:
Daniel James
2017-04-23 10:09:18 +01:00
parent 814926ef31
commit a41a0f3a06
3 changed files with 12 additions and 10 deletions

View File

@ -2758,12 +2758,6 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
return policy::to_bucket(bucket_count_, hash_value);
}
float load_factor() const
{
BOOST_ASSERT(bucket_count_ != 0);
return static_cast<float>(size_) / static_cast<float>(bucket_count_);
}
std::size_t bucket_size(std::size_t index) const
{
node_pointer n = begin(index);

View File

@ -1716,7 +1716,9 @@ unordered_map<K, T, H, P, A>::bucket_size(size_type n) const
template <class K, class T, class H, class P, class A>
float unordered_map<K, T, H, P, A>::load_factor() const BOOST_NOEXCEPT
{
return table_.load_factor();
BOOST_ASSERT(table_.bucket_count_ != 0);
return static_cast<float>(table_.size_) /
static_cast<float>(table_.bucket_count_);
}
template <class K, class T, class H, class P, class A>
@ -2129,7 +2131,9 @@ unordered_multimap<K, T, H, P, A>::bucket_size(size_type n) const
template <class K, class T, class H, class P, class A>
float unordered_multimap<K, T, H, P, A>::load_factor() const BOOST_NOEXCEPT
{
return table_.load_factor();
BOOST_ASSERT(table_.bucket_count_ != 0);
return static_cast<float>(table_.size_) /
static_cast<float>(table_.bucket_count_);
}
template <class K, class T, class H, class P, class A>

View File

@ -1352,7 +1352,9 @@ unordered_set<T, H, P, A>::bucket_size(size_type n) const
template <class T, class H, class P, class A>
float unordered_set<T, H, P, A>::load_factor() const BOOST_NOEXCEPT
{
return table_.load_factor();
BOOST_ASSERT(table_.bucket_count_ != 0);
return static_cast<float>(table_.size_) /
static_cast<float>(table_.bucket_count_);
}
template <class T, class H, class P, class A>
@ -1732,7 +1734,9 @@ unordered_multiset<T, H, P, A>::bucket_size(size_type n) const
template <class T, class H, class P, class A>
float unordered_multiset<T, H, P, A>::load_factor() const BOOST_NOEXCEPT
{
return table_.load_factor();
BOOST_ASSERT(table_.bucket_count_ != 0);
return static_cast<float>(table_.size_) /
static_cast<float>(table_.bucket_count_);
}
template <class T, class H, class P, class A>