diff --git a/src/util/IntrusiveList.hxx b/src/util/IntrusiveList.hxx index 76d2ae1b7..3910dab09 100644 --- a/src/util/IntrusiveList.hxx +++ b/src/util/IntrusiveList.hxx @@ -372,7 +372,7 @@ public: :cursor(_cursor) {} public: - using iterator_category = std::forward_iterator_tag; + using iterator_category = std::bidirectional_iterator_tag; using value_type = T; using difference_type = std::ptrdiff_t; using pointer = value_type *; @@ -400,6 +400,17 @@ public: cursor = cursor->next; return *this; } + + iterator &operator--() noexcept { + cursor = cursor->prev; + return *this; + } + + iterator &operator--(int) noexcept { + auto old = *this; + cursor = cursor->prev; + return old; + } }; constexpr iterator begin() noexcept { @@ -423,7 +434,7 @@ public: :cursor(_cursor) {} public: - using iterator_category = std::forward_iterator_tag; + using iterator_category = std::bidirectional_iterator_tag; using value_type = const T; using difference_type = std::ptrdiff_t; using pointer = value_type *; @@ -454,6 +465,17 @@ public: cursor = cursor->next; return *this; } + + iterator &operator--() noexcept { + cursor = cursor->prev; + return *this; + } + + iterator &operator--(int) noexcept { + auto old = *this; + cursor = cursor->prev; + return old; + } }; constexpr const_iterator begin() const noexcept {