From bb9a02ac518ca921abe6e6440b2f63047f1fa621 Mon Sep 17 00:00:00 2001
From: Justin Carpentier <justin.carpentier@inria.fr>
Date: Thu, 18 Jul 2019 14:34:47 +0200
Subject: [PATCH] core: make convert more versatile

---
 include/eigenpy/details.hpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/eigenpy/details.hpp b/include/eigenpy/details.hpp
index 73f87f5f..1d3b6aa3 100644
--- a/include/eigenpy/details.hpp
+++ b/include/eigenpy/details.hpp
@@ -160,8 +160,12 @@ namespace eigenpy
     }
     
     /// \brief Copy mat into the Python array using Eigen::Map
-    static void convert(Type const & mat, PyArrayObject * pyArray)
+    template<typename MatrixDerived>
+    static void convert(const Eigen::MatrixBase<MatrixDerived> & mat_,
+                        PyArrayObject * pyArray)
     {
+      const MatrixDerived & mat = const_cast<const MatrixDerived &>(mat_.derived());
+      
       if(NumpyEquivalentType<Scalar>::type_code == GET_PY_ARRAY_TYPE(pyArray))
       {
         MapNumpy<MatType,Scalar>::map(pyArray) = mat; // no cast needed
-- 
GitLab