In my code I have a map which holds a large amount of data (~100MB) I need to copy all that data from one map to another. currently I am doing this with swap but to my understanding, swap is a fancy way to do a copy. Is there a way to simply transfer the memory used by the two maps? I think that I can do this with pointers but I was hoping for a more elegant way.
Share
Unless this came up in a profiler run as a bottleneck, you may be optimizing prematurely.
My compiler’s
std::map::swap()has the following comment, which indicates that a map swap is likely to be very fast:(
g++ 4.4.5)