logoalt Hacker News

Joker_vD • today at 3:58 PM • 1 reply • view on HN

> <map> does the work just fine

It has a rather weird interface, at least until C++ 17 when some of the deficiencies were patched somewhat.


Replies

jstimpfle • today at 4:29 PM

It's a slow generic data structure with an unintuitive API. You can use it for leetcode or for CRUD. For anything more demanding it's horrifically bloated and bad. std::string too. Whenever you see STL datatypes like even string and map, you have to deal with RAII, implicit allocations, weird operator syntax, unexpected mutation (invalidation) and so on.

(Spporting or even encouraging destructive mutation, and by this I mean not incrementing counters or anything harmless but allowing iterator invalidations and crashes, are also why std::vector is bad in my opinion, these are idiomatic APIs for 90s and 2000s programming, which we should know better to avoid in 2026).

➕ show 2 replies