Change-Id: I4610946ac27d9d0d73c2fc2e4834bd2cfed88cdc
Tested: on Linux.
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_);
// Run our various test suites:
std::string rawbuf;
- auto flatbuf = CreateFlatBufferTest(rawbuf);
+ auto flatbuf1 = CreateFlatBufferTest(rawbuf);
+ auto flatbuf = std::move(flatbuf1); // Test move assignment.
AccessFlatBufferTest(reinterpret_cast<const uint8_t *>(rawbuf.c_str()),
rawbuf.length());
AccessFlatBufferTest(flatbuf.data(), flatbuf.size());