mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 20:04:29 +02:00
Fix assigning hash/key equality functions for empty containers
This commit is contained in:
@@ -589,7 +589,10 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
mlf_ = x.mlf_;
|
mlf_ = x.mlf_;
|
||||||
recalculate_max_load();
|
recalculate_max_load();
|
||||||
|
|
||||||
if (!size_ && !x.size_) return;
|
if (!size_ && !x.size_) {
|
||||||
|
new_func_this.commit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (x.size_ >= max_load_) {
|
if (x.size_ >= max_load_) {
|
||||||
create_buckets(min_buckets_for_size(x.size_));
|
create_buckets(min_buckets_for_size(x.size_));
|
||||||
|
@@ -77,7 +77,21 @@ void assign_tests2(T*, test::random_generator generator)
|
|||||||
BOOST_DEDUCED_TYPENAME T::allocator_type al2(2);
|
BOOST_DEDUCED_TYPENAME T::allocator_type al2(2);
|
||||||
|
|
||||||
typedef BOOST_DEDUCED_TYPENAME T::allocator_type allocator_type;
|
typedef BOOST_DEDUCED_TYPENAME T::allocator_type allocator_type;
|
||||||
|
|
||||||
|
std::cerr<<"assign_tests2.0 - empty container\n";
|
||||||
|
{
|
||||||
|
test::check_instances check_;
|
||||||
|
|
||||||
|
T x1(0, hf1, eq1);
|
||||||
|
T x2(0, hf2, eq2);
|
||||||
|
x2 = x1;
|
||||||
|
BOOST_TEST(test::equivalent(x1.hash_function(), hf1));
|
||||||
|
BOOST_TEST(test::equivalent(x1.key_eq(), eq1));
|
||||||
|
BOOST_TEST(test::equivalent(x2.hash_function(), hf1));
|
||||||
|
BOOST_TEST(test::equivalent(x2.key_eq(), eq1));
|
||||||
|
test::check_container(x1, x2);
|
||||||
|
}
|
||||||
|
|
||||||
std::cerr<<"assign_tests2.1\n";
|
std::cerr<<"assign_tests2.1\n";
|
||||||
{
|
{
|
||||||
test::check_instances check_;
|
test::check_instances check_;
|
||||||
|
Reference in New Issue
Block a user