-
Notifications
You must be signed in to change notification settings - Fork 2.2k
c++ function that modifies reference not reflected in python #16
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
Comments
The STL auto-binding code in You will have to create your own bindings for a custom std::vector that "stays" on the C++ side, and which can be accessed from Python using iterators and the slicing protocol. See example 6 of the included demo plugin. |
Thanks. I'd rather not change the c++ side and tried to define my vector as:
hoping that |
Can't you just avoid including |
(other than that, your class definition looks good) |
Sure, but then all stl return types need to be manually specialized to get pythonic behavior, right? The project is rather large so slightly more fine-grained control of the implicit stl conversion would probably be useful, perhaps as an option ala the return policies. Thanks / Mikael |
It's tricky due to do this since the type casting system relies on template partial overloads that can't just be turned off once they have been introduced. I'm all ears if you have an idea, but I hesitate to complicate the library for this use case. |
I can surely imagine it's non-trivial; I'll post my solution/workaround here when done. Thanks / Mikael |
eigen: Fix dtype=object shape conversion for 1D NumPy arrays for Eigen matrices
@mlund were you able to find a solution to this issue? |
hi, did you get the solution/workaround for this problem? |
When building additional, auxiliary libraries they should receive proper handling in "native_libs.txt". Surprisingly, this only happens when a trailing `/` is added. Also, the primary module will then go into the package directory. Additional `RPATH`/`RUNPATH` handling for auxiliary, "native" libs is likely needed. E.g. on Linux/OSX: ``` '-DCMAKE_INSTALL_RPATH=$ORIGIN', '-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON', '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=OFF', ``` while on Windows one can just keep a flat structure in the package, which will be in `%PATH%`.
Hi Jakob,
In C++ I have a class
Space
with public membervector<PointParticle> p
and a non-class function template,Wrapping is done with,
In python I can read/write to
p
as one would expect. However, when calling the exposedcm2origo
function, changes top
are not transferred back to python. Any suggestions how to sort this out?The text was updated successfully, but these errors were encountered: