Support boost::multiprecision::cpp_int as BaseType
Hi everyone, as the title says, i was trying to use cpp_int defined in boost::multiprecision as base type. But when i declare a fixed point using cpp_int like this: using position = fpm::fixed<boost_int16_t, int128_t, 16>; i get some errors: fpm/fixed.hpp:21:47: error: static assertion failed: BaseType must be an integral type 21 | static_assert(std::is_integral<BaseType>::value, "BaseType must be an integral type");
fpm/fixed.hpp:47:56: error: no match for 'operator*' (operand types are 'double' and 'const boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<15, 15, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> >') 47 | : m_value(static_cast<BaseType>(std::round(val * FRACTION_MULT)))
And some other. Do you have any suggestions?
Currently, fpm::fixed requires its templated types to be integrals (via a std::is_integral check). Indeed it would be nice to support integral-like types like boost::multiprecision::cpp_int. I'm not sure yet how to verify at compile time that a type is integral-like, but I'll see what can be done. I'll turn this into a feature request.