util/IntrusiveList: add reverse_iterator

This commit is contained in:
Max Kellermann 2023-09-22 20:24:11 +02:00
parent 44daa6d3e6
commit e5680c712b

View File

@ -412,6 +412,16 @@ public:
return {&ToNode(t)};
}
using reverse_iterator = std::reverse_iterator<iterator>;
constexpr reverse_iterator rbegin() noexcept {
return reverse_iterator{end()};
}
constexpr reverse_iterator rend() noexcept {
return reverse_iterator{begin()};
}
class const_iterator final {
friend IntrusiveList;
@ -487,6 +497,16 @@ public:
return {&ToNode(t)};
}
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
constexpr const_reverse_iterator rbegin() const noexcept {
return reverse_iterator{end()};
}
constexpr const_reverse_iterator rend() const noexcept {
return reverse_iterator{begin()};
}
/**
* @return an iterator to the item following the specified one
*/