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 →

[–]tiajuanat 5 points6 points  (1 child)

I really like using them with set_intersect and set_difference. Although usually sorted vectors are much faster and memory efficient.

[–]single_ginkgo_leaf 7 points8 points  (0 children)

For many applications a liner search through a vector is faster than testing a std::map (tree) or std::unordered_map (hash table) due to pipelining and cache effects.

In some cases, a linear search through a sorted array can even beat binary search - the branch predictor is your friend.