From 78d28063c48f3e18ed80bc5aa9b688f5cd736d08 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 21 Sep 2023 13:14:16 +0200 Subject: [PATCH] util/IntrusiveForwardList: push_{front,back}() returns iterator --- src/util/IntrusiveForwardList.hxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/util/IntrusiveForwardList.hxx b/src/util/IntrusiveForwardList.hxx index ea105b591..f6e1532f9 100644 --- a/src/util/IntrusiveForwardList.hxx +++ b/src/util/IntrusiveForwardList.hxx @@ -368,7 +368,7 @@ public: return {&ToNode(t)}; } - void push_front(reference t) noexcept { + iterator push_front(reference t) noexcept { auto &new_node = ToNode(t); if constexpr (options.cache_last) @@ -378,9 +378,11 @@ public: new_node.next = head.next; head.next = &new_node; ++counter; + + return iterator_to(t); } - void push_back(reference t) noexcept + iterator push_back(reference t) noexcept requires(options.cache_last) { auto &new_node = ToNode(t); new_node.next = nullptr; @@ -388,6 +390,8 @@ public: last_cache.value = &new_node; ++counter; + + return iterator_to(t); } static iterator insert_after(iterator pos, reference t) noexcept