why I failed to use a vector reference in a function? #4966
xiaoxiongli
started this conversation in
General
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
in C++ file:
void load_data2(std::vector& data)
{
data[0] =2;
}
PYBIND11_MODULE(libmy_project, m)
in python file:
data = [0]
libmy_project.load_data2(data)
print(data)
the result is [0], Why ? I feel confuse why data not changed?
Beta Was this translation helpful? Give feedback.
All reactions