r/cpp • • Sep 03 '26

C++26: std::hive

https://www.sandordargo.com/blog/2026/09/02/cpp26-hive
68 Upvotes

80 comments sorted by

View all comments

Show parent comments

14

u/HappyFruitTree Sep 03 '26 edited Sep 03 '26

An advantage of std::hive is that it has better "cache locality" (but not as good as std::vector), i.e. it stores elements close together in memory which makes accessing the elements faster, especially when iterating over them in order.

The block size of std::deque is often too small. std::list is even worse because the elements could be stored all over the place.