2 ms·
It's ordered and predictable, which is far from rubbish. In most cases std::unordered_map will be faster, but hashtables have nasty edge cases and are usually
by codr7 3y ago
It's ordered and predictable, which is far from rubbish.
In most cases std::unordered_map will be faster, but hashtables have nasty edge cases and are usually more expensive to create.
I can pretty much guarantee it's been optimized to hell and back.
- JonChesterfield 3y agoUnordered map sure hasn't been. There are algorithmic performance guarantees in the standard that force the linked list of buckets implementation despite that being slower than alternatives. Maybe the libc++ map<> is a very perfect rbtree, but I doubt that's the state of the art in ordered containers either.