From 70ffeadbc63dada1b3933012cb7e10cd191d1b80 Mon Sep 17 00:00:00 2001 From: Joris Vaillant <joris.vaillant@inria.fr> Date: Mon, 5 Feb 2024 15:03:52 +0100 Subject: [PATCH] unique_ptr: Move value instead of releasing it --- include/eigenpy/std_unique_ptr.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/eigenpy/std_unique_ptr.hpp b/include/eigenpy/std_unique_ptr.hpp index d1445670..dcb95dc3 100644 --- a/include/eigenpy/std_unique_ptr.hpp +++ b/include/eigenpy/std_unique_ptr.hpp @@ -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); } } -- GitLab