Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-03-12 08:53:29

Thorsten Ottosen wrote:
> "Daniel Frey" <daniel.frey_at_[hidden]> wrote in message
> news:c2scpf$me8$
> David Abrahams:
> [snip]
>>>Why doesn't
>>> T(pi)
>>Because T can have multiple ctors (taking i.e. float, double, long
>>double and thus making the conversion ambiguous - I can't control that
>>from inside pi, the T is not exactly forwarded to pi's type when asked
>>for a conversion).
> 1. how big is this problem in practice?

Big AFAICT. Most UDTs that I saw have ctors to handle conversions from
the built-in types. I would limit the useable types for no good reason.
Also, the second problem I mentioned is even more serious - and solving
it also solves the ctor-problem.

> 2.couldn't you just make a default choice? Let enable_if disable some if
> there is an ambiguity?

Not an option IMHO. A default is exactly what should be avoided at all
cost. If someone uses quad-doubles or RWDecimal, he has a reason to do
so. Silently injecting doubles (or any other default) could do a lot of
damage and thus will work against the acceptance of the library. Safe
use with no surprises is a lot more important than convenience and a
default type isn't safe.

BTW: These things are good to discuss. I think some of this should make
it to the documentation :)

Regards, Daniel

Daniel Frey
aixigo AG - financial solutions & technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web:

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