Categories
Mastering Development

Why not destory after calling std::move? [closed]

As seen in the following, I can still print "3" after the code printf("%d\n", p1.val);. Isn’t the class p1 destroyed after std::move? code The code is here: class pointer { public: int val; int* my_pointer; pointer() { val = 0; my_pointer = new int; } pointer(pointer&& other) { val = other.val; my_pointer = other.my_pointer; other.my_pointer […]