Skip to content
Snippets Groups Projects
Unverified Commit 70ffeadb authored by Joris Vaillant's avatar Joris Vaillant
Browse files

unique_ptr: Move value instead of releasing it

parent 03cc6324
No related branches found
No related tags found
No related merge requests found
......@@ -22,10 +22,11 @@ template <typename T>
typename std::enable_if<is_class_or_union_remove_cvref<T>::value,
PyObject*>::type
unique_ptr_to_python(std::unique_ptr<T>&& x) {
typedef bp::objects::pointer_holder<std::unique_ptr<T>, T> holder_t;
if (!x) {
return bp::detail::none();
} else {
return bp::detail::make_owning_holder::execute(x.release());
return bp::objects::make_ptr_instance<T, holder_t>::execute(x);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment