Boost logo

Boost :

Subject: Re: [boost] [multiprecision] General/design query about which conversions should be implicit/explicit
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2014-06-04 12:45:04

> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of John Maddock
> Sent: 31 May 2014 12:56
> To: boost_at_[hidden]
> Subject: [boost] [multiprecision] General/design query about which conversions
> should be implicit/explicit
> Folks,
> I have an open bug report
> that requests that conversions from floating point to rational
multiprecision-types be
> made implicit (currently they're explicit).
> Now on the one hand the bug report is correct: these are non-lossy
conversions, so
> there's no harm in them being implicit. However, it still sort of feels wrong
to me,
> the only arguments against I can come up with are:
> 1) An implicit conversion lets you assign values such as 0.1 to a rational
> actually leads to 3602879701896397/36028797018963968 not 1/10), where as
> making the conversion explicit at least forces you to use a cast (or an
> construction).

Killer argument against implicit.

But I can see that a not-at-all-dumb user might prefer otherwise, so as a
compromise could allowing implicit be MACRO controlled?

(We hit this sort of problem back with using NTL, and patched it to permit
implicit conversions so I can understand both views).


Paul A. Bristow
Prizet Farmhouse
Kendal UK LA8 8AB
+44 01539 561830

Boost list run by bdawes at, gregod at, cpdaniel at, john at