util/IntrusiveForwardList: add method iterator_to()

This commit is contained in:
Max Kellermann 2023-09-13 13:49:34 +02:00 committed by Max Kellermann
parent f448bfd3f3
commit 6d39b401b5

View File

@ -301,6 +301,10 @@ public:
return {last_cache.value}; return {last_cache.value};
} }
static constexpr iterator iterator_to(reference t) noexcept {
return {&ToNode(t)};
}
class const_iterator final { class const_iterator final {
friend IntrusiveForwardList; friend IntrusiveForwardList;
@ -358,6 +362,10 @@ public:
return {last_cache.value}; return {last_cache.value};
} }
static constexpr const_iterator iterator_to(const_reference t) noexcept {
return {&ToNode(t)};
}
void push_front(reference t) noexcept { void push_front(reference t) noexcept {
auto &new_node = ToNode(t); auto &new_node = ToNode(t);