From 6d39b401b583af97dcd315f01d653a930bafe6d9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 13 Sep 2023 13:49:34 +0200 Subject: [PATCH] util/IntrusiveForwardList: add method iterator_to() --- src/util/IntrusiveForwardList.hxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/util/IntrusiveForwardList.hxx b/src/util/IntrusiveForwardList.hxx index 770608dd8..72b15bc1c 100644 --- a/src/util/IntrusiveForwardList.hxx +++ b/src/util/IntrusiveForwardList.hxx @@ -301,6 +301,10 @@ public: return {last_cache.value}; } + static constexpr iterator iterator_to(reference t) noexcept { + return {&ToNode(t)}; + } + class const_iterator final { friend IntrusiveForwardList; @@ -358,6 +362,10 @@ public: return {last_cache.value}; } + static constexpr const_iterator iterator_to(const_reference t) noexcept { + return {&ToNode(t)}; + } + void push_front(reference t) noexcept { auto &new_node = ToNode(t);