diff --git a/src/util/IntrusiveForwardList.hxx b/src/util/IntrusiveForwardList.hxx index 82e200317..5bd643c7f 100644 --- a/src/util/IntrusiveForwardList.hxx +++ b/src/util/IntrusiveForwardList.hxx @@ -317,9 +317,10 @@ public: ++counter; } - static iterator insert_after(iterator pos, reference t) noexcept { - // no counter update in this static method - static_assert(!constant_time_size); + static iterator insert_after(iterator pos, reference t) noexcept + requires(!constant_time_size) { + /* if we have no counter, then this method is allowed + to be static */ auto &pos_node = *pos.cursor; auto &new_node = ToNode(t); @@ -328,6 +329,15 @@ public: return &new_node; } + iterator insert_after(iterator pos, reference t) noexcept { + auto &pos_node = *pos.cursor; + auto &new_node = ToNode(t); + new_node.next = pos_node.next; + pos_node.next = &new_node; + ++counter; + return &new_node; + } + void erase_after(iterator pos) noexcept { pos.cursor->next = pos.cursor->next->next; --counter;