[Custom construtor] How to bind a member function as a cumstom construtor? #266
-
I have a existing class A with a member function create which return a shared_ptr object. |
Beta Was this translation helpful? Give feedback.
Answered by
wjakob
Aug 17, 2023
Replies: 1 comment 1 reply
-
You need to move the instance ourself: .def("__init__", [](A* a) { new (a) (A::create()); }); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
huangweiwu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to move the instance ourself: