the.bay.news

C++26: std::hive

Sandor Dargo’s Blog
C++26: std::hive
In a recent article on std::inplace_vector, I mentioned that C++26 is generous with new containers. Here’s the other one: std::hive. Consider a game engine managing thousands of entities. Each entity is stored in a container, and other subsystems hold pointers to those entities. When an entity is destroyed, you erase it from the container. With std::vector, every element after the erased one shifts, invalidating every pointer. With std::list, pointers survive but cache performance suffers. std::hive gives you both: stable pointers and iterators that survive insertions and erasures, O(1) amortized insertion and erasure, and good cache locality thanks to contiguous memory…

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.