Unique pointer #1041
Unanswered
petrasvestartas
asked this question in
Q&A
Unique pointer
#1041
Replies: 1 comment 1 reply
-
Based on your question in 3, I am wondering if what you really want is unique pointers. Shared pointers or intrusive reference counting might be a better ownership model. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using unique pointers in nanobind, without thinking that I need to delete them. Now I am reading this section of documentation:
https://nanobind.readthedocs.io/en/latest/ownership.html
Questions:
consume
method transfers the object from python to c++ where it is eventually destroyed?consume
method and the object instance stays in python what could happen?Data
instance as unique pointer to C++ without deleting it? E.g. to sum-up 2 numbers from the 2 class instances attributes.Beta Was this translation helpful? Give feedback.
All reactions