C.65: clarify pointer move example with comments (issue #1892)

pull/1984/head
Sergey Zubkov 3 years ago
parent 0b22b82159
commit 65aae3ede6

@ -6387,8 +6387,8 @@ Here is a way to move a pointer without a test (imagine it as code in the implem
// move from other.ptr to this->ptr
T* temp = other.ptr;
other.ptr = nullptr;
delete ptr;
ptr = temp;
delete ptr; // in self-move, this->ptr is also null; delete is a no-op
ptr = temp; // in self-move, the original ptr is restored
##### Enforcement

Loading…
Cancel
Save