r/cpp • • May 03 '26

When to actually use a set

https://dubeykartikay.com/posts/why-never-use-std-unordered-set/

reposted with a different title, as i got feedback the previous title was clickbait

21 Upvotes

33 comments sorted by

View all comments

Show parent comment

2

u/BgA_stan May 03 '26

I was implementing ANN for a vector database, and with unordered_set, my implementation was slower than straight brute force 😅

1

u/MiddleSky5296 May 04 '26

It may not be a correct use, then. If you want binary search on sorted elements, std::set<int> should do.