Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2005-10-28 03:01:02

On 10/18/05 9:50 AM, "Fernando Cacciola" <fernando_cacciola_at_[hidden]>

> Hamish Mackenzie wrote:
>> 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

Boost list run by bdawes at, gregod at, cpdaniel at, john at