diff --git a/src/core/ring_buffer.hpp b/src/core/ring_buffer.hpp index 96190d6772..7cac50648e 100644 --- a/src/core/ring_buffer.hpp +++ b/src/core/ring_buffer.hpp @@ -227,7 +227,7 @@ public: } } - ring_buffer(ring_buffer &&other) + ring_buffer(ring_buffer &&other) noexcept { std::swap(this->data, other.data); std::swap(this->head, other.head); @@ -264,7 +264,7 @@ public: return *this; } - ring_buffer& operator =(ring_buffer &&other) + ring_buffer& operator =(ring_buffer &&other) noexcept { if (&other != this) { std::swap(this->data, other.data); @@ -282,6 +282,14 @@ public: } } + void swap(ring_buffer &other) noexcept + { + std::swap(this->data, other.data); + std::swap(this->head, other.head); + std::swap(this->count, other.count); + std::swap(this->mask, other.mask); + } + bool operator ==(const ring_buffer& other) const { if (this->count != other.count) return false;