diff --git a/include/eigenpy/details.hpp b/include/eigenpy/details.hpp index 7e109df4993cf216065c99c55e875fa1074bd36a..65d3d722f74b88eef199d9d8b73b842ce16f86a3 100644 --- a/include/eigenpy/details.hpp +++ b/include/eigenpy/details.hpp @@ -26,6 +26,13 @@ namespace boost { namespace python { namespace detail { std::size_t, value = sizeof(MatType)); }; + template<class MatType> + struct referent_size<Eigen::EigenBase<MatType>&> + { + BOOST_STATIC_CONSTANT( + std::size_t, value = sizeof(MatType)); + }; + }}} namespace boost { namespace python { namespace converter { @@ -93,6 +100,10 @@ struct implicit<MatType,Eigen::MatrixBase<MatType> > } }; +template<class MatType> +struct implicit<MatType,Eigen::EigenBase<MatType> > : implicit<MatType,Eigen::MatrixBase<MatType> > +{}; + }}} // namespace boost::python::converter #define GET_PY_ARRAY_TYPE(array) PyArray_ObjectType(reinterpret_cast<PyObject *>(array), 0) @@ -680,9 +691,13 @@ namespace eigenpy EigenFromPy<MatType>::registration(); // Add also conversion to Eigen::MatrixBase<MatType> - typedef Eigen::MatrixBase<MatType> MatTypeBase; + typedef Eigen::MatrixBase<MatType> MatrixBase; // bp::implicitly_convertible<MatTypeBase,MatType>(); - bp::implicitly_convertible<MatType,MatTypeBase>(); + bp::implicitly_convertible<MatType,MatrixBase>(); + + // Add also conversion to Eigen::EigenBase<MatType> + typedef Eigen::EigenBase<MatType> EigenBase; + bp::implicitly_convertible<MatType,EigenBase>(); } };