util/IntrusiveList: add method erase_and_dispose()

This commit is contained in:
Max Kellermann 2021-02-25 13:38:39 +01:00
parent a0dc398f36
commit 946b3c1f80
1 changed files with 7 additions and 0 deletions

View File

@ -325,6 +325,13 @@ public:
return result;
}
template<typename D>
iterator erase_and_dispose(iterator i, D &&disposer) noexcept {
auto result = erase(i);
disposer(&*i);
return result;
}
void push_front(T &t) noexcept {
insert(begin(), t);
}