Boost logo

Boost :

Subject: Re: [boost] safe-bool CRTP class
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2011-05-28 20:26:39


[Jeffrey Lee Hellrung, Jr.]
> struct _boost_explicit_operator_bool_struct { int _dummy; int member; }; \

[STL]
> You don't need two data members.

[Jeffrey Lee Hellrung, Jr.]
> According to Andrey Semashev (to whom I credit the technique to, and
> should've cited in the above post), you do need two data members, as some
> compilers interpret a pointer-to-first-member as equal to 0 (i.e.,
> convertible to false). I honestly don't know if such compilers exist or are
> technically allowed to do that...

That would be crazy nonconformant. And depressing if true.

STL


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