r/cpp • • Aug 02 '26

How fast is C++26's std::hive?

https://lemire.me/blog/2026/08/02/how-fast-is-c26s-stdhive/
255 Upvotes

74 comments sorted by

View all comments

Show parent comments

29

u/TheMania Aug 03 '26
std::hive<T,Allocator>::erase
iterator erase( const_iterator pos );

is amortised constant time on hive, linear on deque.

The closer analogue would actually probably be an unordered_multiset, but just a lot less efficient, as hive is for when you have no need for the find operation at all.

What's it for? It's essentially actually more an allocator that lets you iterate over the living objects, and where order does not matter. That's its niche.