|
Boost : |
From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2003-09-05 14:13:51
At 20:43 2003-09-05, Ed Brey wrote:
>Following is a bit of utility code that formalizes the safe implicit
>boolean conversion idiom. The idea behind the idiom is that a class
>should be implicitly convertible to bool, but not to integer or pointer
>types that can accidentally be misused.
><snip>
>This is why I didn't use a pointer to member, and why I used the
>reinterpret_cast. A pointer to non-member should be fine, AFAICT, since
>the only implicit operation is subtraction with another pointer of the
>same type, which is OK, since it has the same semantics as subtraction of
>two bools anyway.
This has an implicit conversion to const void*.
--- Daniel Wallin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk