In my c++ code, I have a function like:
bool some_function(std::vector<float>* result){
result->append(1);
result->append(2);
return true;
}
I will update the result vector in "some_function".
I want to use pybind11 to bind this function.
#include<pybind11/pybind11.h>
#include<pybind11/stl.h>
PYBIND11_MODULE(example, m) {
m.def("some_function", &some_function);
}
Then in my python code, I want to use this function like this way:
result = []
is_success = some_function(result)
I expected the result to be updated like: result = [1, 2]
but actually result = []
, still empty.
Please help me how to deal with the pointer parameter in pybind11. Thanks a lot.