Skip to content

Class SlotTable<T>

Namespace: Apogee.Core.Collections
Assembly: Apogee.Core.dll

Items that are looked up by : O(1) add, remove and lookup, freed slots are reused and a handle to a removed item stays invalid for good. Not thread safe.

public sealed class SlotTable<T> where T : class

Type Parameters

T

Inheritance

object ← SlotTable<T>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Properties

Count

public int Count { get; }

Property Value

int

Methods

Add(T)

public SlotHandle Add(T item)

Parameters

item T

Returns

SlotHandle

IsAlive(SlotHandle)

public bool IsAlive(SlotHandle handle)

Parameters

handle SlotHandle

Returns

bool

Remove(SlotHandle)

Removes the item; false when the handle was already stale.

public bool Remove(SlotHandle handle)

Parameters

handle SlotHandle

Returns

bool

TryGet(SlotHandle, out T)

public bool TryGet(SlotHandle handle, out T item)

Parameters

handle SlotHandle

item T

Returns

bool