4 ms·
> People often use set instead of unordered_set (and same for map) despite not needing order. This slows things down. Aren't unordered_set and unordered_map qu
by cesarb 6y ago
> People often use set instead of unordered_set (and same for map) despite not needing order. This slows things down.
Aren't unordered_set and unordered_map quite new (IIRC, they came only with C++0x)? For most of C++'s history, if you preferred to use the standard library, what you had was only ordered sets and maps.
- asdfasgasdgasdg 6y agoThey've been in the language for about a decade now, and before that we had the tr1 hash_map classes that were available in most environments.
- mcguire 6y agoC++: the language that's been around for 40 years and is completely new!
- einpoklum 6y agoActually, C++ has barely been around at all. It is only with C++20, IIANM, that they key features Bjarne Stroustrup wanted to imbue it with are in place (IIRC; see his "Design & Evolution of C++" book from 1994). Some might even argue that the language C++ _should_ be is not even all here; it's still gradually arriving.
- vlovich123 6y agoDepends what’s your definition of “quite new”. That’s over 10 years go now :)
- stonemetal12 6y agoThey were in TR1 in 2005, if I am not mistaken.
- einpoklum 6y agoBy now, this is no longer "quite new". A recent C++ community survey suggests that under 10% of developers currently use C++98/C++03 the most. Naturally this is not a valid sample of the whole userbase, but it's a good indication. Also, in 2005 IIANM, Google published their dense and sparse hash map implementations, which were fast-ish and quite usable.