Boost logo

Boost :

Subject: Re: [boost] BOOST_EXPLICIT_OPERATOR_BOOL macro?
From: Jeffrey Hellrung (jhellrung_at_[hidden])
Date: 2010-04-23 02:28:33


Andrey Semashev wrote:
> I think such a tool would be useful. But I found it more convenient to
> express explicit operator bool through operator!. This allows the check
> to be arbitrarily complex, and the approach adds to compatibility with
> some compilers. See here:
>
> <http://boost-log.svn.sourceforge.net/viewvc/boost-log/trunk/boost-log/boost/log/detail/unspecified_bool.hpp?revision=432&view=markup>

Can you explain why the dummy struct has *two* data members? Is it
because some compilers interpret a pointer-to-member-object to the first
data member of a class as convertible to false?

Thanks,

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk