Hacker News new | ask | show | jobs
by felixguendling 1720 days ago
When reading the title I thought that it is about complexity of linear search vs. better alternatives like hash sets/maps, or at least sorted data structures (binary search).

But if having linear complexity is fine, std::find_if/any_of/none_of/all_of/etc. are of course fine and you should prefer the version that's most expressive.

1 comments

Of course; as Larry Wall said, doing a sequential search over the keys of a hash table is like clubbing someone to death with a loaded Uzi.
It's safer, more reliable, and easier to clean up after?
I doubt it will be safer and more reliable unless the person doesn't fight back. I do agree for cleanup, especially if the bullets go through.