From 91437d9e6348dc60a120ef8df0dc64552fb1e2b6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 21 Jul 2023 13:16:32 +0200 Subject: [PATCH] util/IntrusiveList: add insert_after() --- src/util/IntrusiveList.hxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/IntrusiveList.hxx b/src/util/IntrusiveList.hxx index 319137744..c785fad68 100644 --- a/src/util/IntrusiveList.hxx +++ b/src/util/IntrusiveList.hxx @@ -507,6 +507,13 @@ public: ++counter; } + /** + * Like insert(), but insert after the given position. + */ + void insert_after(iterator p, reference t) noexcept { + insert(std::next(p), t); + } + /** * Move one item of the given list to this one before the * given position.