diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 35d03f4b..deb3a480 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -2758,12 +2758,6 @@ struct table : boost::unordered::detail::functions(size_) / static_cast(bucket_count_); - } - std::size_t bucket_size(std::size_t index) const { node_pointer n = begin(index); diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index f6eeda96..dc8600ba 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -1716,7 +1716,9 @@ unordered_map::bucket_size(size_type n) const template float unordered_map::load_factor() const BOOST_NOEXCEPT { - return table_.load_factor(); + BOOST_ASSERT(table_.bucket_count_ != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count_); } template @@ -2129,7 +2131,9 @@ unordered_multimap::bucket_size(size_type n) const template float unordered_multimap::load_factor() const BOOST_NOEXCEPT { - return table_.load_factor(); + BOOST_ASSERT(table_.bucket_count_ != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count_); } template diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index 75fde4fa..99d1fa2f 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -1352,7 +1352,9 @@ unordered_set::bucket_size(size_type n) const template float unordered_set::load_factor() const BOOST_NOEXCEPT { - return table_.load_factor(); + BOOST_ASSERT(table_.bucket_count_ != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count_); } template @@ -1732,7 +1734,9 @@ unordered_multiset::bucket_size(size_type n) const template float unordered_multiset::load_factor() const BOOST_NOEXCEPT { - return table_.load_factor(); + BOOST_ASSERT(table_.bucket_count_ != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count_); } template