From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Dani Brake via Boost-users
Sent: 13 August 2017 18:39
To: boost-users@lists.boost.org
Cc: Dani Brake
Subject: Re: [Boost-users] deleting operators to forbid mixed arithmetic? [multiprecision]

 

So in principle you just define a full or partial specialization, for example:
template <class Backend>

struct is_compatible_arithmetic_type<double, number<Backend> > : public mpl::false_ {};
and then cross your fingers and hope for the best ;)

 

Thanks for the suggestion, i'll give it a try.  \e crosses fingers

 

Putting a macro bracket around this might make it generally useful, perhaps something like:

 

#ifdef BOOST_MULTIPRECISION_NO_DOUBLE_OPS  (BUILTIN_OPS would include 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.

 

Good luck

 

Paul

 

---

Paul A. Bristow

Prizet Farmhouse

Kendal UK LA8 8AB

+44 (0) 1539 561830