Fix move assign of MonotonicBufferResource
Summary: I was a bit stupid and thought I can use `std::swap`, while `std::swap` is implemented in terms of move itself. Reviewers: mtomic, mferencevic Reviewed By: mtomic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2054
This commit is contained in:
parent
6082d31843
commit
f9471f341d
@ -52,8 +52,14 @@ MonotonicBufferResource::MonotonicBufferResource(
|
||||
|
||||
MonotonicBufferResource &MonotonicBufferResource::operator=(
|
||||
MonotonicBufferResource &&other) noexcept {
|
||||
MonotonicBufferResource tmp(std::move(other));
|
||||
std::swap(*this, tmp);
|
||||
if (this == &other) return *this;
|
||||
Release();
|
||||
memory_ = other.memory_;
|
||||
current_buffer_ = other.current_buffer_;
|
||||
initial_size_ = other.initial_size_;
|
||||
allocated_ = other.allocated_;
|
||||
other.current_buffer_ = nullptr;
|
||||
other.allocated_ = 0U;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user