From d3dfb8b4328ea62eeb3b047c49e1a15231d11336 Mon Sep 17 00:00:00 2001
From: Justin Carpentier <justin.carpentier@inria.fr>
Date: Thu, 18 Jul 2019 14:38:42 +0200
Subject: [PATCH] core: call parent conversion

---
 include/eigenpy/details.hpp | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/include/eigenpy/details.hpp b/include/eigenpy/details.hpp
index 1d3b6aa3..8e4b520f 100644
--- a/include/eigenpy/details.hpp
+++ b/include/eigenpy/details.hpp
@@ -208,22 +208,12 @@ namespace eigenpy
     static void allocate(PyArrayObject * pyArray, void * storage)
     {
       typename MapNumpy<MatType,Scalar>::EigenMap numpyMap = MapNumpy<MatType,Scalar>::map(pyArray);
-      new(storage) Type(numpyMap);
+      new (storage) Type(numpyMap);
     }
     
-    static void convert(Type const & mat , PyArrayObject * pyArray)
+    static void convert(Type const & mat, PyArrayObject * pyArray)
     {
-      if(GET_PY_ARRAY_TYPE(pyArray) == NPY_INT)
-        MapNumpy<MatType,int>::map(pyArray) = mat.template cast<int>();
-      
-      if(GET_PY_ARRAY_TYPE(pyArray) == NPY_LONG)
-        MapNumpy<MatType,long>::map(pyArray) = mat.template cast<long>();
-      
-      if(GET_PY_ARRAY_TYPE(pyArray) == NPY_FLOAT)
-        MapNumpy<MatType,float>::map(pyArray) = mat.template cast<float>();
-      
-      if(GET_PY_ARRAY_TYPE(pyArray) == NPY_DOUBLE)
-        MapNumpy<MatType,double>::map(pyArray) = mat.template cast<double>();
+      EigenObjectAllocator<MatType>::convert(mat,pyArray);
     }
   };
 #endif
-- 
GitLab