diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index f12c9244..b183e378 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2025 Joaquin M Lopez Munoz. +/* Copyright 2003-2026 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -1432,7 +1432,11 @@ class hashed_index:protected SuperMeta::type if(n>max_load){ size_type bc =(std::numeric_limits::max)(); float fbc=1.0f+static_cast(n)/mlf; - if(bc>fbc)bc =static_cast(fbc); + if(bc>fbc){ + bc =(std::max)( + static_cast(fbc), + static_cast(bucket_count()+1)); + } unchecked_rehash(bc); } }