|
Boost : |
From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-03-12 13:35:17
Sam Partington wrote:
>
> Yes, library side fix would be much nicer. But I'm stuck on this. The
> compiler is _really_ helpful here:
>
> z:\test.cpp(37) : error C2593: 'operator &&' is ambiguous
>
> thats it! The compiler docs suggest to resolve the ambiguity you explicity
> cast one or both of the arguments of the operator. But
> if (static_cast<bool>(a) && ...
> is even more of a mouthful. At least there's still no danger of passive
> errors.
Indeed that's not very helpful. But at least - as you said - it fails to
compile so I consider it a non-issue for the operators library. It's a
VC6 problem and the users need to life with it whether or not they use
the operators library, right?
> > Fine. Remember that the name should probably change to reflect the
> > "corrected" semantics. Something like 'bool_negatable'?
> I don't think it does. Actually I always felt that bool_testable was wrong.
> After all equality_comparable provides the inequality test. And
> dereferenceable provides ->. So bool_testable should provide the opposite
> of bool testable. i.e. operator!. If you get me :-)
Agreed.
> As for whether we should seperate the two concepts, perhaps, but I don't any
> occasions when I would want bool_testable and not bool_protector. Therefore
> if we were to seperate them I would like bool_testable to derive from
> bool_protector
>
> bool_protector - prevents accidental conversions to int for classes with
> operator bool
> bool_testable - provides bool operator!(const T&) AND bool_protector
>
> template<class T, class B = ::boost::detail::empty_base>
> struct bool_testable : bool_protector<T, B >
> {...};
>
> But I do ask myself, is this a likely use-scenario?
I don't think so and I wasn't suggesting that it would be a good idea. I
think it's reasonable to have both things tied together. I just wanted
to mention it and see what you think. I think that it's my job as the
maintainer to try to break everything to see how robust it is (and
hopefully not to frustrate anyone). As I'm new in this area, please
correct me if I'm wrong. :)
I think we now have had a fair amount of discussion and as long as you
(or anyone else) don't find another problem, I'm looking forward for
your next patch-set. :)
Regards, Daniel
-- Daniel Frey aixigo AG - financial training, research and 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: http://www.aixigo.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk