Why does the map.insert() method invoke the copy constructor twice?
问题 I'm creating the custom class Node in order to implement a binary tree using a map<int,Node> container: the int key of the map is the identifier of a Node object. In the class Node I had to implement a copy constructor. When inserting a Node object on the map, I noticed that the copy constructor of the Node is invoked twice. Why? cout << "node2" << endl; Node node2; node2.set_depth(2); node2.make_it_branch(3,4); cout << "map" << endl; map<int,Node> mapping; cout << "toInsert" << endl; pair