util/IntrusiveHashSet: add for_each()

This commit is contained in:
Max Kellermann 2022-11-21 10:17:55 +01:00 committed by Max Kellermann
parent 3aa959eda7
commit 200b770104
1 changed files with 12 additions and 0 deletions

View File

@ -245,6 +245,18 @@ public:
return table.front().end();
}
constexpr void for_each(auto &&f) {
for (auto &bucket : table)
for (auto &i : bucket)
f(i);
}
constexpr void for_each(auto &&f) const {
for (const auto &bucket : table)
for (const auto &i : bucket)
f(i);
}
private:
template<typename K>
[[gnu::pure]]