diff --git a/include/eigenpy/scalar-conversion.hpp b/include/eigenpy/scalar-conversion.hpp index 1756b12a56f9ed96c658976bc2853c820227818e..8a8532d9a97d2daf1f6052b3c2e0ffdca58ccbdc 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__