Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2002-08-02 09:15:17


It seems to me that the default ctor should initialize the state to
indeterminate (or whatever it will be called). Since bool doesn't have a
default ctor, this is the most logical behavior for tribool.

I agree with the sentiments regarding the name. Of those suggested thus far, I
like tristate.

I don't think such a simple type should be overly complicated with support for
various numbers of states unless it can be managed by a template and typedef
approach. If a tristate version of such a template uses {true,false,unknown},
while a quadstate version uses {true,false,maybe_true,maybe_false}, etc. -- that
is, each variation can have its own names for the values such that they are
sensible for the number of states -- then it will be sensible. Without those
characteristics, it will be too unwieldy.

I can't think of a use for n-state logic at the moment in my current efforts,
but several of the suggested uses did resonate with me. For example, I have
done GUI programming in the past and a tristate variable would work very nicely
to represent the tristate checkboxes in many GUIs. I can imagine that I might
have need for a tristate class in the future, so it would be nice to have it
available. Unfortunately, I can't say that it is a current or recent need.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk