4 ms·
Yeah, there might be a few cases were null terminated strings work okay but mostly they are just a recipe for buffer overflows. Seriously, how many years is th
by nas 15y ago
Yeah, there might be a few cases were null terminated strings work okay but mostly they are just a recipe for buffer overflows. Seriously, how many years is this going to take to figure out?
- apaprocki 15y agoWell 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.