Boost logo

Boost Users :

Subject: Re: [Boost-users] deleting operators to forbid mixed arithmetic? [multiprecision]
From: Dani Brake (danielthebrake_at_[hidden])
Date: 2017-08-15 22:13:48

Paul and John,

Putting a macro bracket around this might make it generally useful, perhaps
> something like:
> float and long double?)
> …
> template <class Backend>
> struct is_compatible_arithmetic_type<double, number<Backend> > : public
> mpl::false_ {};
> say
> #endif
> If you find this useful, you could create a GIT Pull Request, or just
> email the file changed. You won’t be the only one J. Defining the macro
> BOOST_MULTIPRECISION_NO_DOUBLE_OPS could be a way to detect dodgy
> conversions that need to be changed to keep full precision.

I implemented this in my codebase, and had few ill effects. Some
unexpected conversions, but I did find this disabling very useful.
Wrapping it in a macro bracket and making it officially supported would be

I think it should go in number_base.hpp at line 110 or so. If we wanted to
make it robust and thorough, I think we need to consider turning off
implicit constructors from disabled types, too. I believe that what we
have so far only disables arithmetic.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at