mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-08 14:15:17 +00:00
Added move assignment operator to DetachedBuffer.
Change-Id: I4610946ac27d9d0d73c2fc2e4834bd2cfed88cdc Tested: on Linux.
This commit is contained in:
@@ -453,6 +453,16 @@ class DetachedBuffer {
|
||||
other.size_ = 0;
|
||||
}
|
||||
|
||||
DetachedBuffer &operator=(DetachedBuffer &&other) {
|
||||
std::swap(allocator_, other.allocator_);
|
||||
std::swap(own_allocator_, other.own_allocator_);
|
||||
std::swap(buf_, other.buf_);
|
||||
std::swap(reserved_, other.reserved_);
|
||||
std::swap(cur_, other.cur_);
|
||||
std::swap(size_, other.size_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
~DetachedBuffer() {
|
||||
if (buf_) {
|
||||
assert(allocator_);
|
||||
|
||||
Reference in New Issue
Block a user