Hacker News new | ask | show | jobs
by boricj 29 days ago
That's basically what I've done at work on my embedded project.

Object pools, with indices and generations. Way, way easier than meddling with raw pointers, cheaper than shared_ptr/weak_ptr and no clean-up required when deleting stuff because the stored generation won't match the new object's generation. You can even make that default-constructible if you increment the generation on instantiation too (so that only even generations are alive) and hide it all behind high-level abstractions with C++.

Though my knowledge of these techniques come from 2000s video game architectures, as games like GTA: Vice City are known to use it.