-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
I know dealing with references is never easy when wrapping low-level languages in high-level languages (I've fought with this in SWIG and Cython), but how would I get a dummy function like this working:
void plus_one_inplace(int &i) { i++; }
I tried:
PYBIND11_PLUGIN(ex) {
py::module m("ex", "example");
m.def("plus_one_inplace", &plus_one_inplace, "add one inplace");
return m.ptr();
}
but when I do
i=1
ex.plus_one_inplace(i)
i
is still equal to 1
Guptajakala, ninafiona, SianSSYang, dentiny and ccjeremylo
Metadata
Metadata
Assignees
Labels
No labels