Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-16 19:36:26

----- Original Message -----
From: <williamkempf_at_[hidden]>\
> > 6) It's better to provide an operator const void*() method instead
> of
> > operator bool(). (Unlike bool the const void* one won't implicitly
> convert
> > to umpteen different types).
> This argument has come up on here before, and I'm not 100% sure that
> a consensus opinion was reached on this. Conversion to bool is more
> natural to my mind, and the implicit conversion "to umpteen different
> types" doesn't seem to dangerous to me... at least in this case.
> Changing this will be trivial, so I'll defer to the "experts"
> opinions on this, but I'm not sure that they've fully agreed with
> each other in the past. Am I wrong?

I think the consensus is that implicit conversions are dangerous, but if you
must provide them, you should avoid implicit conversions to bool.


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