autowrap icon indicating copy to clipboard operation
autowrap copied to clipboard

[Feature] Preserve shared_ptrs for non-const-ref std::vector conversion

Open jpfeuffer opened this issue 3 years ago • 6 comments

Preserves the old PyClass instances and their memory and allocates the difference to the new size. Also removes one copy, since it copies the data directly to the memory addresses of the old and new Python objects.

jpfeuffer avatar Mar 30 '21 09:03 jpfeuffer

@hroest

jpfeuffer avatar Mar 30 '21 09:03 jpfeuffer

@jpfeuffer this sounds good if that is the case we described, can you add a test to autowrap? also why does this add a ton of boost code?

hroest avatar Apr 03 '21 01:04 hroest

Can we add a switch to enable or disable C++11 features? I don't want to break other users code when they use older build chains in their projects.

uweschmitt avatar Apr 06 '21 08:04 uweschmitt

@uweschmitt Yes, I considered that already. Will do. @hroest I am not sure if it solves all our problems but it should be a) a bit more efficient due to the moves and b) a bit more of the data will be at the same place when moving back to the original list locations. I will think about a good test. And the new boost code is for make_shared, which requires boost's own move "module".

jpfeuffer avatar Apr 06 '21 08:04 jpfeuffer

Oh, by the way, libcpp_move requires a fairly recent Cython. Are you okay with that?

jpfeuffer avatar Apr 06 '21 08:04 jpfeuffer

Oh, by the way, libcpp_move requires a fairly recent Cython. Are you okay with that?

Yes, a minimal version requirement can be specified in setup.py and thus upgrading autowrap will not break this. The C-compiler setup on the target machine is out of our hands.

uweschmitt avatar Apr 06 '21 10:04 uweschmitt