r/cpp • u/BgA_stan • 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
18
Upvotes
View all comments
Show parent comment
19
u/arthurno1 May 03 '26
Clickbait.
Not to be rude, but what is the problem in being honest and simply stating the intention as intended? I think we are all tired of clickbaits and "X considered harmful" titles.
Well-written article otherwise! Thanks :).
Also, to add, there are other uses for key-value data structures, than just with integer keys. Strings are also very common, for example for various language parsers, options parsers, stuff like that. With strings, if you have a list (set) of keys known in advance, i.e. at compile time, you could also use gperf to generate a perfect hash. Seems to beat everything else. Would be nice to see a comparison with other keys and gperf vs other containers, hashmaps, decision trees and alike.