fix: func_handle for rule of two (#3169)

* Fix func_handle for rule of two

* Apply reviewer suggestion
This commit is contained in:
Aaron Gokaslan 2021-08-03 13:15:48 -04:00 committed by GitHub
parent f4f4632e28
commit c0756ccd93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,9 +70,11 @@ public:
struct func_handle {
function f;
func_handle(function &&f_) noexcept : f(std::move(f_)) {}
func_handle(const func_handle& f_) {
func_handle(const func_handle &f_) { operator=(f_); }
func_handle &operator=(const func_handle &f_) {
gil_scoped_acquire acq;
f = f_.f;
return *this;
}
~func_handle() {
gil_scoped_acquire acq;