Boost logo

Boost :

Subject: Re: [boost] safe bool operator
From: Domagoj Saric (dsaritz_at_[hidden])
Date: 2010-03-01 16:50:16

"Scott McMurray" <[hidden]> wrote in message
> 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!; \
> }

This forces classes to have operator! and it still suffers from efficiency
issues outlined in the first post...

"What Huxley teaches is that in the age of advanced technology, spiritual 
devastation is more likely to come from an enemy with a smiling face than from 
one whose countenance exudes suspicion and hate."
Neil Postman 

Boost list run by bdawes at, gregod at, cpdaniel at, john at