4 ms·
I really like this tweet[1], which is bit cheeky, but gets also at the issue that everyone "basic" needs are actually different. [1]: https://twitter.com/steve
by jrimbault 5y ago
I really like this tweet[1], which is bit cheeky, but gets also at the issue that everyone "basic" needs are actually different.
[1]: https://twitter.com/steveklabnik/status/1367854800193413126 https://twitter.com/steveklabnik/status/1367854800193413126
- Macha 5y agoTo be fair, C++ has std::map and iostream/printf, so two of the examples given here as "in Rust's standard library and not in C++'s" are wrong. Now there are reasons many people choose not to use the built in C++ std::map, and very nearly this ended up the case for Rust's HashMap, until they switched the implementation to the crate that was becoming popular. But even there's design decisions, like Rust using more compute to have a strong hash to avoid DoS attacks, that some may feel are inappropriate for their use cases.
- jcranmer 5y agoYou probably mean std::unordered_map, not std::map. std::map is a red-black tree, so it's akin to TreeMap in Java or BTreeMap in Rust. (It really is a shame that the smallest name for an associative array in C++ is for the version that is the least useful).