I put together a post about handle lookup containers (also known as sparse sets) here - https://tomhultonharrop.com/c++/lookup/handle/2024/01/07/handle-lookup-container.html. Very much inspired by the work of @niklasgray, @floooh and Noel Llopis.
Handle Lookup Container (Sparse Set)

Topic

Tom Hulton-Harrop

@tom_h_h @niklasgray @floooh Some extra wild ideas perhaps:

0) the first issue isn't a problem for rust :)

1) mix the handles based on the address of the pool they come from to help detect cases where you access the wrong pool with a handle https://github.com/jsimmons/narcissus/blob/main/engine/narcissus-core/src/pool.rs#L36-L104

2) instead of killing the slot after running out of space, i maintain some extra slots always available, to extend the power of the small generation counter. https://github.com/jsimmons/narcissus/blob/main/engine/narcissus-core/src/pool.rs#L23-L26

narcissus/engine/narcissus-core/src/pool.rs at main · jsimmons/narcissus

Contribute to jsimmons/narcissus development by creating an account on GitHub.

GitHub
@dotstdy @niklasgray @floooh Thanks very much for taking a look and the suggestions. I'll definitely take a look at the repo you mentioned for more inspiration 🙂 Cheers!