[init] no_init and noncopyable #265
-
Does nanobind have functionalities similar to no_init and noncopyable in Boost.Python that can prevent Python from initializing and copying the bound C++ classes? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Class bindings are If you completely want to avoid copies of a class being made, then that only works if the class declares a deleted copy constructor (which nanobind detects and respects). |
Beta Was this translation helpful? Give feedback.
-
I declares a deleted copy constructor for a class and use init_implicit to enable implicit conversions. |
Beta Was this translation helpful? Give feedback.
Class bindings are
no_init
by default unless you bind some kind of a constructor. A copy constructor must also be bound explicitly.If you completely want to avoid copies of a class being made, then that only works if the class declares a deleted copy constructor (which nanobind detects and respects).