diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index deb3a480..f680283c 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -2776,17 +2776,6 @@ struct table : boost::unordered::detail::functions(mlf_) * - static_cast(max_bucket_count()))) - - 1; - } - void recalculate_max_load() { using namespace std; diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index dc8600ba..b0e7055d 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -1497,7 +1497,13 @@ unordered_map& unordered_map::operator=( template std::size_t unordered_map::max_size() const BOOST_NOEXCEPT { - return table_.max_size(); + using namespace std; + + // size <= mlf_ * count + return boost::unordered::detail::double_to_size( + ceil(static_cast(table_.mlf_) * + static_cast(table_.max_bucket_count()))) - + 1; } // modifiers @@ -1931,7 +1937,13 @@ unordered_multimap& unordered_multimap::operator=( template std::size_t unordered_multimap::max_size() const BOOST_NOEXCEPT { - return table_.max_size(); + using namespace std; + + // size <= mlf_ * count + return boost::unordered::detail::double_to_size( + ceil(static_cast(table_.mlf_) * + static_cast(table_.max_bucket_count()))) - + 1; } // modifiers diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index 99d1fa2f..86f553c4 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -1193,7 +1193,13 @@ unordered_set& unordered_set::operator=( template std::size_t unordered_set::max_size() const BOOST_NOEXCEPT { - return table_.max_size(); + using namespace std; + + // size < mlf_ * count + return boost::unordered::detail::double_to_size( + ceil(static_cast(table_.mlf_) * + static_cast(table_.max_bucket_count()))) - + 1; } // modifiers @@ -1566,7 +1572,13 @@ unordered_multiset& unordered_multiset::operator=( template std::size_t unordered_multiset::max_size() const BOOST_NOEXCEPT { - return table_.max_size(); + using namespace std; + + // size < mlf_ * count + return boost::unordered::detail::double_to_size( + ceil(static_cast(table_.mlf_) * + static_cast(table_.max_bucket_count()))) - + 1; } // modifiers