This commit is contained in:
2026-09-25 20:22:29 -07:00
parent 4ebae57cf8
commit 0d145f615d
10 changed files with 100 additions and 16 deletions
+11
View File
@@ -75,6 +75,17 @@ class Pool {
}
}
/** Calls `fn(handle, item)` for every live item. */
template <typename Fn>
void forEachWithHandle(Fn&& fn) const {
for (u32 index = 0; index < slots.size(); index++) {
const Slot& slot = slots[index];
if (slot.item) {
fn(Handle<T>{index, slot.generation}, *slot.item);
}
}
}
template <typename Predicate>
T* findIf(Predicate&& predicate) {
return const_cast<T*>(