Signed-off-by: Kefu Chai <kchai@redhat.com>
// -- buffer::list --
+ buffer::list::list(list&& other)
+ : _buffers(std::move(other._buffers)),
+ _len(other._len),
+ _memcopy_count(other._memcopy_count),
+ last_p(this) {
+ append_buffer.swap(other.append_buffer);
+ other.clear();
+ }
+
void buffer::list::swap(list& other)
{
std::swap(_len, other._len);
_memcopy_count(other._memcopy_count), last_p(this) {
make_shareable();
}
+ list(list&& other);
list& operator= (const list& other) {
if (this != &other) {
_buffers = other._buffers;
bufferlist copy(bl);
ASSERT_EQ('A', copy[0]);
}
+ //
+ // list(list&& other)
+ //
+ {
+ bufferlist bl(1);
+ bl.append('A');
+ bufferlist copy = std::move(bl);
+ ASSERT_EQ(0U, bl.length());
+ ASSERT_EQ(1U, copy.length());
+ ASSERT_EQ('A', copy[0]);
+ }
}
TEST(BufferList, operator_equal) {