Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"Features" was probably the wrong word for me to use. What I was referring to is interface + customizability.

The STL map allows you to:

- specify the key/value types

- specify the equality predicate

- specify which hash function to use

- iterate over values

along with a host of other things that most users don't initially need but they might need in the future.

You could implement something that has feature parity in C++ or ideally find a battle-tested library that does.

Using C, however, you'd have to sacrifice type safety and possibly readability. Yes it can be done, and yes it can be done correctly. But it's tricky and difficult to ramp up on for the new developer. This is the one that you should be careful about adopting.

My philosophy is to use the STL containers because they're familiar and they're more than good enough for 99% of the use cases out there. Developer time has a premium, and this saves developer time.

If you need performance because you're constrained by CPU cycles or if you're running at scale (Google for example), by all means reach for something better.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: