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/Hafnon May 08 '26

Why are you using the sorted flat_set and comparing it to unordered_set? The invariants are different, iterating the flat_set needs to be in sorted order. You should be using unordered_flat_set from Boost.