I have a TMap that I need to copy the contents of another TMap into. If I was using vanilla C++ STL’s map class, I could use the insert method to do this, but I don’t see an equivalent in Unreal’s TMap class so I was wondering what the correct approach would be. I see that there is an override of the = operator, but the documentation doesn’t really describe its semantics. Will it delete anything previously in the TMap being copied to? Is this a deep or shallow copy, what happens to the contents of the original TMap, etc. Considering how much trouble I have trying to grok pre C++11 template stuff, I’m having even less success trying to understand the underlying template structures that Unreal uses that take advantage of C++11.
I’m new to C++11 but this looks like a C++11 move signature to me. If it’s like std::move (which I suspect it is - Move Semantics: https://docs.unrealengine.com/latest/INT/Programming/Development/CodingStandard/index.html)
The TMap you pass in will have it’s contents “stolen” and have its pointers set to null.
Try it and inspect it in the debugger
Hoping someone more knowledgeable can chime and correct me.
If you’re looking to replace the existing map you can use =. Otherwise if you’re looking to add the contents of the map in to the other map you should use Append.