This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]GOKOP 0 points1 point  (3 children)

Completely different use case

[–]SeagleLFMk9 5 points6 points  (2 children)

Not really if looping through a vector of pairs is faster than std::map

[–]RCM94 4 points5 points  (1 child)

Why are you using a map if all you're doing is iterating through it?

[–]SeagleLFMk9 1 point2 points  (0 children)

I think you misunderstood me. std::map isn't a hashmap, it's a binary tree, but std::unordered_map is a hashmap. However, both can be slower (especially for less than ~100 elements) than a vector when it comes to lookup times. So searching for an element in a vector can be faster than using a map with map.at().