Closed cr-mitmit closed 2 years ago
any reason that it was not merged ?
any reason that it was not merged ?
Hi,
this feature has been already implemented in c++17
branch that was recently merged onto the master
one.
I've added a section to documentation: Auto-wrapping objects
So I'm closing this pull request.
Support auto_wrap when a pointer type is returned from function. In existing code, when a pointer type is returned from wrapped method, it will ignore the autowrap flag and only wrap if object is already wrapped using `class::referenceexternal::import_external`.
With this patch, when a pointer type is returned (technically when passed to find_object) if auto-wrap is supported either of the following two happens.
or
classauto_wrap
forclass_<T, shared_ptr_traits>
, this object is wrapped and returned.auto_wrap
forclass_<T, raw_ptr_traits>
and T isstd::is_copy_constructible
than T is copy-constructed the copy* is wrapped. Otherwise, the existing behavior (i.e. returning an empty handle) is keptThis patch includes the changes in ptr_traits.hpp and additional tests to ensure the above works correctly.