From eeb955a82f255f27c3eb70b482d7c52bff607202 Mon Sep 17 00:00:00 2001
From: Justin Carpentier <justin.carpentier@inria.fr>
Date: Fri, 26 Jan 2024 14:18:10 +0100
Subject: [PATCH] core: use boost::numerics to simplify the code and make it
 more generic

---
 include/eigenpy/scalar-conversion.hpp | 62 +++------------------------
 1 file changed, 5 insertions(+), 57 deletions(-)

diff --git a/include/eigenpy/scalar-conversion.hpp b/include/eigenpy/scalar-conversion.hpp
index 1756b12a..8a8532d9 100644
--- a/include/eigenpy/scalar-conversion.hpp
+++ b/include/eigenpy/scalar-conversion.hpp
@@ -1,70 +1,18 @@
 //
-// Copyright (c) 2014-2020 CNRS INRIA
+// Copyright (c) 2014-2024 CNRS INRIA
 //
 
 #ifndef __eigenpy_scalar_conversion_hpp__
 #define __eigenpy_scalar_conversion_hpp__
 
 #include "eigenpy/config.hpp"
+#include <boost/numeric/conversion/conversion_traits.hpp>
 
 namespace eigenpy {
-template <typename SCALAR1, typename SCALAR2>
-struct FromTypeToType : public boost::false_type {};
+template <typename Source, typename Target>
+struct FromTypeToType
+    : public boost::numeric::conversion_traits<Source, Target>::subranged {};
 
-template <typename SCALAR>
-struct FromTypeToType<SCALAR, SCALAR> : public boost::true_type {};
-
-template <>
-struct FromTypeToType<int, long> : public boost::true_type {};
-template <>
-struct FromTypeToType<int, float> : public boost::true_type {};
-template <>
-struct FromTypeToType<int, std::complex<float> > : public boost::true_type {};
-template <>
-struct FromTypeToType<int, double> : public boost::true_type {};
-template <>
-struct FromTypeToType<int, std::complex<double> > : public boost::true_type {};
-template <>
-struct FromTypeToType<int, long double> : public boost::true_type {};
-template <>
-struct FromTypeToType<int, std::complex<long double> >
-    : public boost::true_type {};
-
-template <>
-struct FromTypeToType<long, float> : public boost::true_type {};
-template <>
-struct FromTypeToType<long, std::complex<float> > : public boost::true_type {};
-template <>
-struct FromTypeToType<long, double> : public boost::true_type {};
-template <>
-struct FromTypeToType<long, std::complex<double> > : public boost::true_type {};
-template <>
-struct FromTypeToType<long, long double> : public boost::true_type {};
-template <>
-struct FromTypeToType<long, std::complex<long double> >
-    : public boost::true_type {};
-
-template <>
-struct FromTypeToType<float, std::complex<float> > : public boost::true_type {};
-template <>
-struct FromTypeToType<float, double> : public boost::true_type {};
-template <>
-struct FromTypeToType<float, std::complex<double> > : public boost::true_type {
-};
-template <>
-struct FromTypeToType<float, long double> : public boost::true_type {};
-template <>
-struct FromTypeToType<float, std::complex<long double> >
-    : public boost::true_type {};
-
-template <>
-struct FromTypeToType<double, std::complex<double> > : public boost::true_type {
-};
-template <>
-struct FromTypeToType<double, long double> : public boost::true_type {};
-template <>
-struct FromTypeToType<double, std::complex<long double> >
-    : public boost::true_type {};
 }  // namespace eigenpy
 
 #endif  // __eigenpy_scalar_conversion_hpp__
-- 
GitLab