
22 Sep
2005
22 Sep
'05
1:38 a.m.
Ariel Badichi <abadichi@bezeqint.net> writes:
David Abrahams wrote:
it's easy to arrange that only a literal zero works there.
How?
Allow assignment only from a private member pointer type. It's similar to the operator safe_bool idiom.
I thought you might mean that. That allows more than a literal zero, though (e.g., 5 * 5 - 25).
Yikes! I didn't know that. Too bad!
By the way, that might work well for smart pointers; why don't shared_ptr and friends use this idiom?
Maybe because it allows more than a literal zero? -- Dave Abrahams Boost Consulting www.boost-consulting.com