Skip to content

Commit 77060f5

Browse files
authored
Clarify
1 parent 6639ef6 commit 77060f5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

inst/include/cpp11/external_pointer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ class external_pointer {
7272
}
7373

7474
external_pointer& operator=(external_pointer&& rhs) noexcept {
75+
// This works even if `this == &rhs` because `data_` (a `cpp11::sexp`) handles the underlying resource.
7576
data_ = rhs.data_;
77+
// Order matters: first assign, then clear the RHS.
7678
rhs.data_ = R_NilValue;
7779
return *this;
7880
}

0 commit comments

Comments
 (0)