#include <unordered_map>
#include "MyClass.h"
int main()
{
std::unordered_map<int, MyClass> mc_map;
mc_map[0] = MyClass(0); // Create the first object
mc_map[1] = MyClass(1); // Create the second object
// Create a third object based on the previous two and put it
// in the place of the first object
mc_map[0] = MyClass(mc_map[0], mc_map[1]); // <--- THIS LINE
return 0;
}
Is this the marked line valid? The object `mc_map[0]` wouldn't be destroyed before it is read from by the `MyClass(MyClass, MyClass)` constructor, right?