diff options
Diffstat (limited to 'src/common/scratch_buffer.h')
| -rw-r--r-- | src/common/scratch_buffer.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/common/scratch_buffer.h b/src/common/scratch_buffer.h index d5961b020..2a98cda53 100644 --- a/src/common/scratch_buffer.h +++ b/src/common/scratch_buffer.h | |||
| @@ -40,8 +40,21 @@ public: | |||
| 40 | ~ScratchBuffer() = default; | 40 | ~ScratchBuffer() = default; |
| 41 | ScratchBuffer(const ScratchBuffer&) = delete; | 41 | ScratchBuffer(const ScratchBuffer&) = delete; |
| 42 | ScratchBuffer& operator=(const ScratchBuffer&) = delete; | 42 | ScratchBuffer& operator=(const ScratchBuffer&) = delete; |
| 43 | ScratchBuffer(ScratchBuffer&&) = default; | 43 | |
| 44 | ScratchBuffer& operator=(ScratchBuffer&&) = default; | 44 | ScratchBuffer(ScratchBuffer&& other) noexcept { |
| 45 | swap(other); | ||
| 46 | other.last_requested_size = 0; | ||
| 47 | other.buffer_capacity = 0; | ||
| 48 | other.buffer.reset(); | ||
| 49 | } | ||
| 50 | |||
| 51 | ScratchBuffer& operator=(ScratchBuffer&& other) noexcept { | ||
| 52 | swap(other); | ||
| 53 | other.last_requested_size = 0; | ||
| 54 | other.buffer_capacity = 0; | ||
| 55 | other.buffer.reset(); | ||
| 56 | return *this; | ||
| 57 | } | ||
| 45 | 58 | ||
| 46 | /// This will only grow the buffer's capacity if size is greater than the current capacity. | 59 | /// This will only grow the buffer's capacity if size is greater than the current capacity. |
| 47 | /// The previously held data will remain intact. | 60 | /// The previously held data will remain intact. |