diff --git a/CHANGELOG.md b/CHANGELOG.md index 6018181e..c3a8d386 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ Version XXX: +* moved-from dynamic buffers do not clear if different allocator * fix erase field -------------------------------------------------------------------------------- diff --git a/include/boost/beast/core/impl/flat_buffer.hpp b/include/boost/beast/core/impl/flat_buffer.hpp index 83d3b4e7..e0792e0c 100644 --- a/include/boost/beast/core/impl/flat_buffer.hpp +++ b/include/boost/beast/core/impl/flat_buffer.hpp @@ -124,8 +124,6 @@ basic_flat_buffer( end_ = nullptr; max_ = other.max_; copy_from(other); - other.clear(); - other.shrink_to_fit(); return; } @@ -436,8 +434,6 @@ move_assign(basic_flat_buffer& other, std::false_type) if(this->get() != other.get()) { copy_from(other); - other.clear(); - other.shrink_to_fit(); } else { diff --git a/include/boost/beast/core/impl/multi_buffer.hpp b/include/boost/beast/core/impl/multi_buffer.hpp index 29a10fa1..0d8b1b42 100644 --- a/include/boost/beast/core/impl/multi_buffer.hpp +++ b/include/boost/beast/core/impl/multi_buffer.hpp @@ -502,8 +502,6 @@ basic_multi_buffer( { out_ = list_.end(); copy_from(other); - other.clear(); - other.shrink_to_fit(); return; } @@ -1060,8 +1058,6 @@ move_assign(basic_multi_buffer& other, std::false_type) if(this->get() != other.get()) { copy_from(other); - other.clear(); - other.shrink_to_fit(); } else { diff --git a/include/boost/beast/http/impl/fields.hpp b/include/boost/beast/http/impl/fields.hpp index f3d609e8..dde92b92 100644 --- a/include/boost/beast/http/impl/fields.hpp +++ b/include/boost/beast/http/impl/fields.hpp @@ -382,7 +382,6 @@ basic_fields(basic_fields&& other, Allocator const& alloc) if(this->get() != other.get()) { copy_all(other); - other.clear_all(); } else { @@ -1139,7 +1138,6 @@ move_assign(basic_fields& other, std::false_type) if(this->get() != other.get()) { copy_all(other); - other.clear_all(); } else { diff --git a/test/beast/core/flat_buffer.cpp b/test/beast/core/flat_buffer.cpp index 274b6ed4..df7b06a9 100644 --- a/test/beast/core/flat_buffer.cpp +++ b/test/beast/core/flat_buffer.cpp @@ -103,8 +103,8 @@ public: ostream(b1) << "Hello"; a_neq_t a; basic_flat_buffer b2{std::move(b1), a}; - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); + BEAST_EXPECT(b1.size() != 0); + BEAST_EXPECT(b1.capacity() != 0); BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello"); BEAST_EXPECT(b1.max_size() == b2.max_size()); } @@ -186,8 +186,8 @@ public: basic_flat_buffer b2; b2 = std::move(b1); BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); + BEAST_EXPECT(b1.size() != 0); + BEAST_EXPECT(b1.capacity() != 0); BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello"); } { diff --git a/test/beast/core/multi_buffer.cpp b/test/beast/core/multi_buffer.cpp index 095af9be..223ec948 100644 --- a/test/beast/core/multi_buffer.cpp +++ b/test/beast/core/multi_buffer.cpp @@ -237,8 +237,8 @@ public: ostream(b1) << "Hello"; unequal_t a; basic_multi_buffer b2{std::move(b1), a}; - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); + BEAST_EXPECT(b1.size() != 0); + BEAST_EXPECT(b1.capacity() != 0); BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello"); BEAST_EXPECT(b1.max_size() == b2.max_size()); } @@ -300,8 +300,8 @@ public: basic_multi_buffer b2; b2 = std::move(b1); BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); + BEAST_EXPECT(b1.size() != 0); + BEAST_EXPECT(b1.capacity() != 0); BEAST_EXPECT(buffers_to_string(b2.data()) == "Hello"); } {