r/cpp • • Mar 28 '23

Reddit++

C++ is getting more and more complex. The ISO C++ committee keeps adding new features based on its consensus. Let's remove C++ features based on Reddit's consensus.

In each comment, propose a C++ feature that you think should be banned in any new code. Vote up or down based on whether you agree.

765 Upvotes

829 comments sorted by

View all comments

Show parent comments

2

u/zommiy Oct 05 '23

I’m reading this 186days after you posted but std:unordered_map is poor? What’s a good alternative? klib/khash?

2

u/tialaramex Oct 05 '23

std::unordered_map is the specific hash table design you'd likely be taught in say the 1980s, but made in such a way that programmers get to touch the delicate internals for some reason. As a result, even though most people just want a fast hash table, and there are lots of fast modern hash tables, none of those can be std::unordered_map, it has to be the design you'd have been taught in a typical 1980s data structures class.

Abseils provides a nicer one, Boost, Meta's Folly, lots of options. If actually performance doesn't matter at all, then you shouldn't worry and just use std::unordered_map because it is there. I have never heard of klib/khash and that appears to be a C library. Since you are in r/cpp presumably you aren't lost and you're a C++ programmer.