
1 Mar
2010
1 Mar
'10
9:06 p.m.
On 1 March 2010 15:36, Domagoj Saric <domagoj.saric@littleendian.com> wrote:
//or by using a macro BOOST_SAFE_BOOL_FROM_FUNCTION( some_is_valid_function() )
Is there a reason it can't just always look at operator!? I've been using a macro like this, since I don't need the workarounds: #define OPERATOR_SAFE_BOOL(for_type) \ typedef bool (for_type::*unspecified_bool_type)() const; \ operator unspecified_bool_type() const { \ return !*this ? 0 : &for_type::operator!; \ } so then it's just class my_class { public: bool operator!() const; OPERATOR_SAFE_BOOL(my_class) };