-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy-constructor #14
Comments
Furthermore, running the example from the documentation, it seems that the destructor is never called, and the variant stays valid even after calling destroy(). |
Thanks for bringing up these two issues.
I have to think about this how to solve this correctly. So it is not your fault. Good catch. At the moment you have to retrieve the dtor of the raw type itself. This two issues will be fixed in the upcoming release of 0.9.6 |
Thank you for your quick reply! |
Now implicit the raw_type will always be used when retrieving the dtor from a type. First part of the issue: #14
…"as_std_shared_ptr". This might break some code silently! Without this change it is not possible to register a constructor from a class which has a deleted or private copy constructor. This change will allow now the registration of these kind of classes. shared_ptr is a valid choice because it has automatic memory management. Its better here to be explicit and have one rule, instead of doing some hidden magic for this case. To have the old binding behaviour back, add the policy: 'policy::ctor::as_object' to every constructor registration::class_<MyStruct>("MyStruct") .constructor<>() ( policy::ctor::as_object ); Remark: When you want to real type of the created instance in the variant, use 'type::get_wrapped_type()' This will fix issue #14
both issues are now fixed and merged to master in 0.9.6 |
I am a new (since yesterday) user of the library, and first of all I wanted to tank you for such an useful tool.
I am starting now to explore the API and running some tests.
It seems that registration of a class requires a copy-constructor, even if
rttr::policy::ctor::as_raw_ptr
is used.Small example attached.
test.zip
This fails to build with a static assert.
Am I missing something?
Thank you in advance!
The text was updated successfully, but these errors were encountered: