Skip to content

[Custom construtor] How to bind a member function as a cumstom construtor? #266

Closed Answered by wjakob
huangweiwu asked this question in Q&A
Discussion options

You must be logged in to vote

You need to move the instance ourself:

.def("__init__", [](A* a) { new (a) (A::create()); });

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@huangweiwu
Comment options

Answer selected by huangweiwu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants