"Sam Partington" <[EMAIL PROTECTED]> writes: > 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. > After all the conversion operator itself has to be a member, so it probably > isn't much of a restriction at all.
Ahem. The operators library is *all about* defining free function operators. I don't think you should introduce a dependence on being a member function. > Then again, how much does the safe_bool_conversion function cost? More than I'd like. I'd prefer to use a single data member pointer, since it's likely to be more efficient. struct safe_bool { #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS private: template <class T, class B> friend class bool_testable; #endif int x; typedef int safe_bool::*type; }; -- Dave Abrahams Boost Consulting www.boost-consulting.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost