
On 10/18/05 9:50 AM, "Fernando Cacciola" <fernando_cacciola@hotmail.com> wrote:
Hamish Mackenzie wrote: [SNIP]
Could the unifying concept OptionalPointee be implemented as free functions?
Of course.
Notice that there are alternatives for safe_bool() that doesn't require dropping * and ->. These alternatives fix the problem with optional<bool>. One example is to simply provide operator !, used like this:
if ( !!opt ) is_initialized();
(this is what my initial boost submission did)
I would find having type with an "operator not" but not any Boolean conversion to be a surprise. In fact, I filed a bug for Boost.Rational having this problem. (But I think that case was by accident, not design.) The double-not operator as a workaround for Boolean conversion is an idiom that we should NOT be introducing. -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com