Skip to content

nanobind a vector of a NonCopyable class #712

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

You must be logged in to vote

I had missed something in my design: the class MyContainer is naturally not copyable, but I forgot to explicitly delete the constructor.
In pure C++, the copy-constructor is never called so the program compiles. Nanobind must be trying to instanciate a copy.

Adding MyContainer(const MyContainer&) = delete; fixes everything.

The case for a_single_part works because the compiler implicitly deletes it for us.

Replies: 2 comments 1 reply

Comment options

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

Comment options

You must be logged in to vote
0 replies
Answer selected by JeanDidierGaraud
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