Import std.collections.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.
Examples
Local names = Pool<String>()
Local ada = names.Add("Ada")
names.Add("Alan")
Expect(names.Get(ada) == "Ada")
Expect(names.Remove(ada))
Expect(names.Get(ada) == Null)
// Grace takes Ada's slot, but Ada's Handle still finds nothing.
Local grace = names.Add("Grace")
Expect(grace.Index == ada.Index && names.Get(ada) == Null)
Expect(names.Count == 2)std/collections/pool.fb, line 43
-
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.
Report an issue with this page or with FutureBlitz on GitHub.