4 ms·
I had once assumed std::unordered_map was from the original Standard Template Library (which pre-dates C++ standardization), but turns out (I was told in a r/cp
by tialaramex 4y ago
I had once assumed std::unordered_map was from the original Standard Template Library (which pre-dates C++ standardization), but turns out (I was told in a r/cpp thread) it's more modern. In 1998 std::unordered_map would have been an excusable design mistake, domain experts knew in 1998 that's a sub-optimal design for this dict / hashmap structure - but you could suppose perhaps they were not on the committee. In 2011 it's not an excusable mistake, better structures are widely known in academic and in industry - it was an unforced error.
The more closely I look at it, the more I'm convinced that unsafety wasn't an inadvertent and undesirable consequence of a "must go fast" mindset in standard C++, unsafety was the whole point. It makes me think about that speech by Susan Sarandon's Rick & Morty character, Dr Wong.
Dr Wong: "I have no doubt that you would be bored senseless by therapy, the same way I'm bored when I brush my teeth and wipe my ass, because the thing about repairing, maintaining, and cleaning is; it's not an adventure. There's no way to do it so wrong you might die."
Software Engineering is an engineering discipline, it is not supposed to be an adventure. Programming C++ is an adventure, you can do it so wrong you might die. We should stop paying people to go on an adventure, let them do that exclusively on their free time if they want.
- gpderetta 4y agohash_map was indeed part of the original STL, but was not standardized in C++98. It was still widely available, in slightly incompatible forms, as an extension. In C++11 it was standardized with only minor changes (and renamed). The address-preserving property, which precludes an optimal implementation, was considered important to be a near drop-in replacement of std::map.