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

unique_ptr: Specialize to_python_value to manage unique_ptr in the default_call_policies

parent d302024d
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,9 @@
#include "eigenpy/eigen-typedef.hpp"
#include "eigenpy/expose.hpp"
/// Custom CallPolicies
#include "eigenpy/std_unique_ptr.hpp"
#define ENABLE_SPECIFIC_MATRIX_TYPE(TYPE) \
::eigenpy::enableEigenPySpecific<TYPE>();
......
......@@ -130,4 +130,15 @@ struct ReturnInternalStdUniquePtr : bp::return_internal_reference<> {
} // namespace eigenpy
namespace boost {
namespace python {
template <typename T>
struct to_python_value<const std::unique_ptr<T>&>
: eigenpy::details::StdUniquePtrResultConverter::apply<
std::unique_ptr<T> >::type {};
} // namespace python
} // namespace boost
#endif // ifndef __eigenpy_utils_std_unique_ptr_hpp__
......@@ -35,10 +35,8 @@ BOOST_PYTHON_MODULE(std_unique_ptr) {
bp::class_<V1>("V1", bp::init<>()).def_readwrite("v", &V1::v);
bp::def("make_unique_int", make_unique_int,
eigenpy::StdUniquePtrCallPolicies());
bp::def("make_unique_v1", make_unique_v1,
eigenpy::StdUniquePtrCallPolicies());
bp::def("make_unique_int", make_unique_int);
bp::def("make_unique_v1", make_unique_v1);
bp::def("make_unique_null", make_unique_null,
eigenpy::StdUniquePtrCallPolicies());
......
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