From 39629ad15685d7bd3a1ad30ad80130b9f0b7bd89 Mon Sep 17 00:00:00 2001 From: Justin Carpentier <justin.carpentier@inria.fr> Date: Mon, 24 Feb 2020 07:55:23 +0100 Subject: [PATCH] core: add template specialization for NumpyAllocator with Eigen::Ref --- include/eigenpy/numpy-allocator.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/eigenpy/numpy-allocator.hpp b/include/eigenpy/numpy-allocator.hpp index 02a74215..d35032fe 100644 --- a/include/eigenpy/numpy-allocator.hpp +++ b/include/eigenpy/numpy-allocator.hpp @@ -50,6 +50,15 @@ namespace eigenpy } }; +#if EIGEN_VERSION_AT_LEAST(3,2,0) + + template<typename MatType> + struct NumpyAllocator<Eigen::Ref<MatType> > : NumpyAllocator<MatType &> + { + }; + +#endif + template<typename MatType> struct NumpyAllocator<const MatType &> { @@ -69,6 +78,15 @@ namespace eigenpy return pyArray; } }; + +#if EIGEN_VERSION_AT_LEAST(3,2,0) + + template<typename MatType> + struct NumpyAllocator<const Eigen::Ref<const MatType> > : NumpyAllocator<const MatType &> + { + }; + +#endif } #endif // ifndef __eigenpy_numpy_allocator_hpp__ -- GitLab