Slot map
A container that stores elements densely yet hands out stable handles of an index plus a generation counter, so a stale handle is recognised and rejected.
Pointers to objects in a growing array go invalid the moment the array moves or a slot is reused. A slot map solves this by returning a handle — an index and a generation number — instead of a pointer. When a slot is freed and reused, its generation is bumped, so an old handle pointing at the same index carries the wrong generation and is quietly refused.
Internally the elements are stored densely for cache-friendly iteration, with an indirection table translating handles to slots. Insert, erase and lookup are all O(1). The pattern is a staple of C++ game code — ECS libraries like EnTT build on it — and is, in effect, a generational index packaged as a ready-made container.