Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling T* and T& of function parameter #4

Open
edimetia3d opened this issue Sep 8, 2023 · 0 comments
Open

Handling T* and T& of function parameter #4

edimetia3d opened this issue Sep 8, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@edimetia3d
Copy link
Owner

edimetia3d commented Sep 8, 2023

When a function uses T* (or T & ) as a parameter, this function will usually want to modify the object it pointed to, e.g.

ErrorCode GetValue(int * v);
ErrorCode GetValue(std::vector<int> * vec);

However:

  1. Python itself does not support mutable int
  2. pybind11 will create a copy when T is a std container type, any modification to the copied object will not return to python runtime.

These cases should be handled automatically, or at least a warning should be printed.

@edimetia3d edimetia3d added the enhancement New feature or request label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant