mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
Replace a usage of C++14 language features with C++11 code (#1833)
This commit is contained in:
parent
9fd4712121
commit
74d335a535
@ -65,12 +65,19 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
value = [hfunc = func_handle(std::move(func))](Args... args) -> Return {
|
// to emulate 'move initialization capture' in C++11
|
||||||
gil_scoped_acquire acq;
|
struct func_wrapper {
|
||||||
object retval(hfunc.f(std::forward<Args>(args)...));
|
func_handle hfunc;
|
||||||
/* Visual studio 2015 parser issue: need parentheses around this expression */
|
func_wrapper(func_handle&& hf): hfunc(std::move(hf)) {}
|
||||||
return (retval.template cast<Return>());
|
Return operator()(Args... args) const {
|
||||||
|
gil_scoped_acquire acq;
|
||||||
|
object retval(hfunc.f(std::forward<Args>(args)...));
|
||||||
|
/* Visual studio 2015 parser issue: need parentheses around this expression */
|
||||||
|
return (retval.template cast<Return>());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
value = func_wrapper(func_handle(std::move(func)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user