Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-12-10 14:26:19

From: "Fernando Cacciola" <fernando_cacciola_at_[hidden]>
> I understand your reasoning, but what do you suggest?

I suggest that we need not give much weight to optional<bool> when designing
optional<T>'s interface.

> Leaving optional<bool> inherently unsafe?

Unsafe? The conversion from optional<bool> to bool might be confusing, but
it's not inherently unsafe.

> with a strong remark on the
> documentation that you should been using optional<bool> in the first

This would be a good idea.

> Or specializing optional<bool>, perhaps, with a empty definition so that
> is explicitly banned?

No, as you point out, this would create problems when generic code that uses
optional<T> receives T=bool. But generic code wouldn't expect the conversion
from optional<T> to bool to yield the value of the optional, right?

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