std::map<int, Obj> mp;
// insert elements into mp
// case 1
std::map<int, Obj> mp2;
mp2 = std::move(mp);
// case 2
std::map<int, Obj> mp3;
std::move(std::begin(mp), std::end(mp), std::inserter(mp3, std::end(mp3));
I am confused by the two cases. Are they exactly the same?
mp3
.std::move
leaves the nodes in second tree as are, just their contents being moved: Assumestd::map<std::vector<...>>
, then the vector's contents are moved, while the vectors in the first map themselves remain (usually empty).