mirror of
https://github.com/boostorg/beast.git
synced 2025-08-03 06:44:39 +02:00
moved-from container with unequal allocator will not be modified:
Affects: - flat_buffer - multi_buffer - http::fields fixes #1832 closes #1834
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
Version XXX:
|
Version XXX:
|
||||||
|
|
||||||
|
* moved-from dynamic buffers do not clear if different allocator
|
||||||
* fix erase field
|
* fix erase field
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@@ -124,8 +124,6 @@ basic_flat_buffer(
|
|||||||
end_ = nullptr;
|
end_ = nullptr;
|
||||||
max_ = other.max_;
|
max_ = other.max_;
|
||||||
copy_from(other);
|
copy_from(other);
|
||||||
other.clear();
|
|
||||||
other.shrink_to_fit();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,8 +434,6 @@ move_assign(basic_flat_buffer& other, std::false_type)
|
|||||||
if(this->get() != other.get())
|
if(this->get() != other.get())
|
||||||
{
|
{
|
||||||
copy_from(other);
|
copy_from(other);
|
||||||
other.clear();
|
|
||||||
other.shrink_to_fit();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -502,8 +502,6 @@ basic_multi_buffer(
|
|||||||
{
|
{
|
||||||
out_ = list_.end();
|
out_ = list_.end();
|
||||||
copy_from(other);
|
copy_from(other);
|
||||||
other.clear();
|
|
||||||
other.shrink_to_fit();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1060,8 +1058,6 @@ move_assign(basic_multi_buffer& other, std::false_type)
|
|||||||
if(this->get() != other.get())
|
if(this->get() != other.get())
|
||||||
{
|
{
|
||||||
copy_from(other);
|
copy_from(other);
|
||||||
other.clear();
|
|
||||||
other.shrink_to_fit();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -382,7 +382,6 @@ basic_fields(basic_fields&& other, Allocator const& alloc)
|
|||||||
if(this->get() != other.get())
|
if(this->get() != other.get())
|
||||||
{
|
{
|
||||||
copy_all(other);
|
copy_all(other);
|
||||||
other.clear_all();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1139,7 +1138,6 @@ move_assign(basic_fields& other, std::false_type)
|
|||||||
if(this->get() != other.get())
|
if(this->get() != other.get())
|
||||||
{
|
{
|
||||||
copy_all(other);
|
copy_all(other);
|
||||||
other.clear_all();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -103,8 +103,8 @@ public:
|
|||||||
ostream(b1) << "Hello";
|
ostream(b1) << "Hello";
|
||||||
a_neq_t a;
|
a_neq_t a;
|
||||||
basic_flat_buffer<a_neq_t> b2{std::move(b1), a};
|
basic_flat_buffer<a_neq_t> b2{std::move(b1), a};
|
||||||
BEAST_EXPECT(b1.size() == 0);
|
BEAST_EXPECT(b1.size() != 0);
|
||||||
BEAST_EXPECT(b1.capacity() == 0);
|
BEAST_EXPECT(b1.capacity() != 0);
|
||||||
BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello");
|
BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello");
|
||||||
BEAST_EXPECT(b1.max_size() == b2.max_size());
|
BEAST_EXPECT(b1.max_size() == b2.max_size());
|
||||||
}
|
}
|
||||||
@@ -186,8 +186,8 @@ public:
|
|||||||
basic_flat_buffer<na_t> b2;
|
basic_flat_buffer<na_t> b2;
|
||||||
b2 = std::move(b1);
|
b2 = std::move(b1);
|
||||||
BEAST_EXPECT(b1.get_allocator() != b2.get_allocator());
|
BEAST_EXPECT(b1.get_allocator() != b2.get_allocator());
|
||||||
BEAST_EXPECT(b1.size() == 0);
|
BEAST_EXPECT(b1.size() != 0);
|
||||||
BEAST_EXPECT(b1.capacity() == 0);
|
BEAST_EXPECT(b1.capacity() != 0);
|
||||||
BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello");
|
BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@@ -237,8 +237,8 @@ public:
|
|||||||
ostream(b1) << "Hello";
|
ostream(b1) << "Hello";
|
||||||
unequal_t a;
|
unequal_t a;
|
||||||
basic_multi_buffer<unequal_t> b2{std::move(b1), a};
|
basic_multi_buffer<unequal_t> b2{std::move(b1), a};
|
||||||
BEAST_EXPECT(b1.size() == 0);
|
BEAST_EXPECT(b1.size() != 0);
|
||||||
BEAST_EXPECT(b1.capacity() == 0);
|
BEAST_EXPECT(b1.capacity() != 0);
|
||||||
BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello");
|
BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello");
|
||||||
BEAST_EXPECT(b1.max_size() == b2.max_size());
|
BEAST_EXPECT(b1.max_size() == b2.max_size());
|
||||||
}
|
}
|
||||||
@@ -300,8 +300,8 @@ public:
|
|||||||
basic_multi_buffer<na_t> b2;
|
basic_multi_buffer<na_t> b2;
|
||||||
b2 = std::move(b1);
|
b2 = std::move(b1);
|
||||||
BEAST_EXPECT(b1.get_allocator() != b2.get_allocator());
|
BEAST_EXPECT(b1.get_allocator() != b2.get_allocator());
|
||||||
BEAST_EXPECT(b1.size() == 0);
|
BEAST_EXPECT(b1.size() != 0);
|
||||||
BEAST_EXPECT(b1.capacity() == 0);
|
BEAST_EXPECT(b1.capacity() != 0);
|
||||||
BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello");
|
BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user