From: Daniel Frey (d.frey_at_[hidden])
Date: 2003-11-28 17:48:43
On Thu, 27 Nov 2003 20:27:57 +0100, Sam Partington wrote:
>> OK, you are right. We have bool_testable in CVS, so we are discussing
>> whether or not it should be removed (and probably replaced by a good
>> explanation of Peter's idiom) or if it should be officially released in
>> 1.31.0. I think it should be removed, I would just like to make sure
>> that we agree on it. If I find some time at the weekend, I'll try to
>> write some appropriate docs and prepare the patch to remove
>> bool_testable. Even if we want bool_testable later, we can still add it
>> in 1.32.0.
> Wait, how did we get here when we haven't even properly discussed the
> I have posted another implementation in the thread "Another safe-bool
> aternative", which I believe meets the criteria required, and its not
> been commented on. And yet here we are discussing removing it
We get here since we are still discussing. Removing it is a precaution not
to release unfinished stuff too early. My main concern are the users,
although I know that it's frustrating for the developers to see their code
Some comments for everyone suggesting alternatives:
- The current bool_testable offers a lot of good things. Remember it works
even when the user adds operator int() to the derived class. Does your
solution work in this situation? This is IMHO an essential feature to make
it really safe to use!
- The users supplies operator bool(). Simple and clean. Whatever you
propose, at least it shouldn't be more complex than applying Peter's idiom
by hand. Otherwise, there is no point in having bool_testable.
- It was often mentioned that the current bool_testable breaks
is_convertible. With all due respect, but that's just a POV. The interface
is actually correct. Conversions to bool compile, anything else doesn't.
Couldn't we also say that is_convertible is "broken" because it can't
detect that the type is not convertible to, say, int? It's actually not
convertible, but not because there is no conversion, but because the
conversion is inaccessible or ambiguous. And besides this issue and the
better error messages from Peter's idiom, I know of *no* problem with
bool_testable. OK, I know that is_convertible cannot be fixed with the
current language. But OTOH, we are seeking help from the compiler for the
type-traits anyway, so why not add this to the wishlist? ;)
- No overhead! Both Peter's idiom (with Daveed's extension) as well as
bool_testable are free of any overhead (OK, just runtime/memory, not
compile-time :). If you suggest an alternative, think about this, too.
I hope we can find a solution, currently I haven't seen anything which
offers all features. If I missed a solution, please kindly point me to it.
Since then bool_testable will be deferred, that is, it will not make it
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk