util/IntrusiveList: iterators are bidirectional
This commit is contained in:
parent
78d8b5f73c
commit
b5d224496f
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user