Re:Strcpycat
by apaprocki on Friday January 20, 2012 @10:56PM
(#3492551)
Well move semantics were only introduced in C++11. So until C++11 is supported natively everywhere you can't build something like:
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.
[ Parent
| on HN ]
As 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.