From bdfdb9808aa96916016287d1f7b46219662ced02 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 19 Aug 2023 12:25:15 +0100 Subject: [PATCH] Ring buffer: Add iterator conversions --- src/core/ring_buffer.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/ring_buffer.hpp b/src/core/ring_buffer.hpp index 7cac50648e..a35edb08ca 100644 --- a/src/core/ring_buffer.hpp +++ b/src/core/ring_buffer.hpp @@ -61,6 +61,9 @@ public: ring_buffer_iterator() : ring_buffer_iterator_base() {} + ring_buffer_iterator(const ring_buffer_iterator_base &other) + : ring_buffer_iterator_base(other.ring, other.pos) {} + private: ring_buffer_iterator(const ring_buffer *ring, uint32 pos) : ring_buffer_iterator_base(ring, pos) {} @@ -151,12 +154,12 @@ public: return *this; } - bool operator ==(const ring_buffer_iterator &other) const + bool operator ==(const ring_buffer_iterator_base &other) const { return (this->ring == other.ring) && (this->pos == other.pos); } - bool operator !=(const ring_buffer_iterator &other) const + bool operator !=(const ring_buffer_iterator_base &other) const { return !operator ==(other); }