Import std.collections.pool
std.collections.pool
Pool<T>: values kept by Handles that stay valid until their value is removed, like a game's
enemies. A removed value's slot is reused, and its Generation counts how many times, so an
old Handle to it finds nothing. Generations start at 1, so a Handle's zero finds nothing too.
std/collections/pool.fb
Types
Handle
struct
Public Struct Handle<T> Implements Hashable
Where a value is in its Pool, which only the Pool makes. Two are equal when they're the same value's, so a Handle can be a Map's key or a Set's value.
std/collections/pool.fb, line 9
-
Its slot in the Pool.
Pool
class
@DebugElements Public Class Pool<T> Implements Iterable<T>, Cloneable, Defaultable
Values kept by Handles that stay valid until their value is removed, reusing removed values' slots.
std/collections/pool.fb, line 17
-
How many values it holds.
-
How many values it has slots for before it needs more memory.
-
Makes room for
countslots in all, so adding up to that many values doesn't move them again. -
Adds the
value, and gives its Handle. -
The
handle's value, or Null once it's removed. -
Gives the
handle'svaluea new value, and tells whether it's still there. -
Whether the
handle's value is still there: its slot hasn't been emptied since. -
Removes the
handle's value, and tells whether it was there. -
Removes every value. Their Handles find nothing after.
-
A new, empty Pool.
-
A new Pool with the same values, which the same Handles find.
-
The values, in the order of their slots. Removing values while going over them is fine.
-
Each value with its Handle, in the order of their slots, for 'For handle, value In pool.IterateHandles()'. Removing values while going over them is fine.
PoolIterator
struct
Public Struct PoolIterator<T> Implements Iterator<T>
The values of a Pool, in slot order, which For ... In goes over.
std/collections/pool.fb, line 125
-
The next value, or Null when there are no more.
Doc from
std.core.iterator.Iterator.Next.
PoolHandles
struct
Public Struct PoolHandles<T> Implements Iterator<(Handle<T>, T)>
The values of a Pool with their Handles, as (handle, value), in slot order.
std/collections/pool.fb, line 139
-
The next value, or Null when there are no more.
Doc from
std.core.iterator.Iterator.Next.
Report an issue with this page or with FutureBlitz on GitHub.