ring-buffer-iterator: fix postfix increment/decrement

this silently did the wrong thing on g++ (precedence of postfix ++/--)
and didn't compile on clang++. The correct solution is to
prefix-increment, which has no precedence issues and calls the correct
function. Postfix-increment with correct precedence would have resulted
in a stack overflow anyway.
This commit is contained in:
2025-05-12 15:20:33 +02:00
parent 3bad408674
commit 1a8b098ed0

View File

@ -61,7 +61,7 @@ public:
}
CONSTEXPR ring_buffer_iterator operator++(int) NOEXCEPT {
ring_buffer_iterator old = *this;
*this++;
++*this;
return old;
}
CONSTEXPR ring_buffer_iterator& operator--() NOEXCEPT {
@ -70,7 +70,7 @@ public:
}
CONSTEXPR ring_buffer_iterator operator--(int) NOEXCEPT {
ring_buffer_iterator old = *this;
*this--;
--*this;
return old;
}
@ -161,7 +161,7 @@ public:
}
CONSTEXPR ring_buffer_const_iterator operator++(int) NOEXCEPT {
ring_buffer_const_iterator old = *this;
*this++;
++*this;
return old;
}
CONSTEXPR ring_buffer_const_iterator& operator--() NOEXCEPT {
@ -170,7 +170,7 @@ public:
}
CONSTEXPR ring_buffer_const_iterator operator--(int) NOEXCEPT {
ring_buffer_const_iterator old = *this;
*this--;
--*this;
return old;
}