From 4a019ad63c6c85a9559c26f8a2c3cacf08c4cd17 Mon Sep 17 00:00:00 2001 From: Raoul Rubien Date: Mon, 12 May 2025 14:12:09 +0200 Subject: [PATCH] fixes ring-buffer-iterator swap() --- include/ring-buffer-iterator.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ring-buffer-iterator.h b/include/ring-buffer-iterator.h index b599060..0360b4d 100644 --- a/include/ring-buffer-iterator.h +++ b/include/ring-buffer-iterator.h @@ -97,9 +97,9 @@ public: CONSTEXPR friend ring_buffer_iterator operator+(difference_type n, const ring_buffer_iterator& it) NOEXCEPT { return it + n; } - CONSTEXPR friend void swap(ring_buffer_iterator& a, ring_buffer_iterator& b) COND_NOEXCEPT(noexcept(std::swap(a.container, b.container))) { + CONSTEXPR friend void swap(ring_buffer_iterator& a, ring_buffer_iterator& b) COND_NOEXCEPT(noexcept(std::swap(a.container_ptr, b.container_ptr))) { using std::swap; - swap(a.container, b.container); + swap(a.container_ptr, b.container_ptr); swap(a.front, b.front); swap(a.index, b.index); } @@ -197,9 +197,9 @@ public: CONSTEXPR friend ring_buffer_const_iterator operator+(difference_type n, const ring_buffer_const_iterator& it) NOEXCEPT { return it + n; } - CONSTEXPR friend void swap(ring_buffer_const_iterator& a, ring_buffer_const_iterator& b) COND_NOEXCEPT(noexcept(std::swap(a.container, b.container))) { + CONSTEXPR friend void swap(ring_buffer_const_iterator& a, ring_buffer_const_iterator& b) COND_NOEXCEPT(noexcept(std::swap(a.container_ptr, b.container_ptr))) { using std::swap; - swap(a.container, b.container); + swap(a.container_ptr, b.container_ptr); swap(a.front, b.front); swap(a.index, b.index); }