Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2003-08-31 20:13:50


Brian McNamara <lorgon_at_[hidden]> wrote:

> I should mention in passing that, while in general I think "implicit
> conversions" are bad news and should be avoided whenever reasonable, I
> do think the "conversion to bool" is an exceptional case, simply because
> it is already so deeply ingrained in C++ (and C) language/culture.
>
> (Fortunately bool has a very narrow interface, so it doesn't get us into
> too much trouble. Implicit conversions to user-defined types may create
> arbitrary interface conflicts/conceptual ambiguities, and this is where
> the real trouble begins.)

Perhaps, but we were also taught that operator overloading may create
arbitrary interface conflicts/conceptual ambiguities, and this is where
the real trouble begins ;-)

That may be true in some (many?) contexts, but it is not definitely universally
true. As I mentioned in another post, I never had, nor seen, any complaints
about reference_wrapper<T>, which incidentally, has an implicit conversion
to T. ref(var) has been in extensive use by a lot of libraries for many years now.

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk