Sam Partington wrote:
> 
> I thought of this too, but this limits the user to using a member based
> operator!.  So I couldn't do this :
> 
> class A : public boost::bool_testable<A>
> {
> public:
>     int get();
> };
> 
> bool operator!(const A& a)
> {
>     return a.get() == 0;
> }
> 
> Of course I've never actually wanted to do that, so its maybe not a problem.

In fact this is what I want to prevent. Consider a global operator! with
a template parameter:

template< typename T > bool operator!( const T& t )
{
    return t.get() == 0;
}

This may lead to "accidents" I tried to avoid. We now have to decide
whether want to allow it or to prevent it. Sadly you cannot use &T::~T
:)

> Then again, how much does the safe_bool_conversion function cost?

Not much. I think we should find an agreed on goal to achive, the
implementation follows naturally. What do you (and others) think? Should
we allow or prevent non-const-member-function-operator!-implementations?

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: [EMAIL PROTECTED], web: http://www.aixigo.de
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to