changes
This commit is contained in:
@@ -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*>(
|
||||
|
||||
Reference in New Issue
Block a user