From d817a31af129fd124c8aeac131cb4bb322cf2e1c Mon Sep 17 00:00:00 2001
From: Justin Carpentier <justin.carpentier@inria.fr>
Date: Wed, 29 Jan 2020 16:10:37 +0100
Subject: [PATCH] core: add the implicit convertor to Eigen::EigenBase

---
 include/eigenpy/details.hpp | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/include/eigenpy/details.hpp b/include/eigenpy/details.hpp
index 7e109df..65d3d72 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>();
     }
   };
 
-- 
GitLab