4 ms·
Well move semantics were only introduced in C++11. So until C++11 is supported natively everywhere you can't build something like: std::map<std::string, int>
by apaprocki 15y ago
Well move semantics were only introduced in C++11. So until C++11 is supported natively everywhere you can't build something like:
std::map<std::string, int>
without paying for a extra copy of the string on insertion. How many years since C++ has existed before they finally allowed for a single copy? Everything is relative. You might never have had a need to worry about that double copy, but there are other people who have.
- minimax 15y agoAs long as you're worrying about the double copy, you may as well worry about chasing the pointers in your map through the cache hierarchy. Usually I'd use unordered_map here unless there was a good reason not to.