On 12/08/2017 00:53, Dani Brake via Boost-users wrote:
Hi,
I'd like to forbid multiplication of Boost.Multiprecision floating
point numbers by doubles. Any tips? I think I want to delete a
family of operator*s, but am having a hard time coming up with which ones.
All the operators are enable_if'ed on "is_compatible_arithmetic_type::value" where V is the arithmetic type and M is the multiprecision
type. The trait is defined in
boost/multiprecision/detail/number_base.hpp as:
template
struct is_compatible_arithmetic_type
: public mpl::bool_<
is_convertible::value
&& !is_same::value
&& !is_number_expression<T>::value>
{};
So in principle you just define a full or partial specialization, for
example:
template <class Backend>
struct is_compatible_arithmetic_type : public
mpl::false_ {};
and then cross your fingers and hope for the best ;)
This is untried, and it's quite likely there will be collateral damage -
things which should compile but don't any more because they multiply by
0.5 or something.
HTH, John.
---
This email has been checked for viruses by AVG.
http://www.avg.com