why I failed to use a vector reference in a function? #4966
xiaoxiongli
started this conversation in
General
Replies: 1 comment
-
me too |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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