Boost logo

Boost :

From: James Porter (porterj_at_[hidden])
Date: 2008-05-22 10:38:01

Corrado Zoccolo wrote:
> There is still a problem with this approach. The non overloaded operators ||
> and && will usually do the wrong thing, causing the tribool to be first
> converted to bool, and then to go through the short-circuited evaluation.
> You should disable operators || and && completely using private overloads.

That's true. It would probably cause some initial confusion, but better
to be surprised with a compiler error than an obscure logic error! :)

There's also the issue of backwards-compatibility, but I think the
default behavior should be to throw a compiler error when attempting to
use operators || or && with a tribool. That could be resolved with a
simple preprocessor macro to re-enable || and &&, though.

- Jim

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