A 3-state boolean type.

3-state boolean values are either true, false, or indeterminate.

The actual stored value in this 3-state boolean, which may be false, true, or indeterminate.

enum boost::logic::tribool::value_t
BOOST_CONSTEXPR

Use a 3-state boolean in a boolean context. Will evaluate true in a boolean context only when the 3-state boolean is definitely true.

true if the 3-state boolean is true, false otherwise

Will not throw.

Construct a new 3-state boolean value with the value 'false'.

Will not throw.

bool

Construct a new 3-state boolean value with the given boolean value, which may be `true` or `false`.

Will not throw.

indeterminate_keyword_t

Construct a new 3-state boolean value with an indeterminate value.

Will not throw.

BOOST_CONSTEXPR bool ``tribool`` `unspecifiedunspecified` Keyword and test function for the indeterminate tribool value.

The `indeterminate` function has a dual role. It's first role is as a unary function that tells whether the tribool value is in the "indeterminate" state. It's second role is as a keyword representing the indeterminate (just like "true" and "false" represent the true and false states). If you do not like the name "indeterminate", and would prefer to use a different name, see the macro `BOOST_TRIBOOL_THIRD_STATE`.

`x.value == tribool::indeterminate_value`

Will not throw.

BOOST_CONSTEXPR `tribool` ``tribool`` Computes the logical negation of a tribool.

the logical negation of the tribool, according to the table:

`!` |
false | true
true | false
indeterminate | indeterminate

Will not throw.

BOOST_CONSTEXPR `tribool` ``tribool`` ``tribool``
BOOST_CONSTEXPR `tribool` ``tribool`` `bool`
BOOST_CONSTEXPR `tribool` `bool` ``tribool``
BOOST_CONSTEXPR `tribool` `indeterminate_keyword_t` ``tribool``
BOOST_CONSTEXPR `tribool` ``tribool`` `indeterminate_keyword_t`
Computes the logical conjuction of two tribools.

the result of logically ANDing the two tribool values, according to the following table:

`&&` | false | true | indeterminate
false | false | false | false
true | false | true | indeterminate
indeterminate | false | indeterminate | indeterminate

Will not throw.

BOOST_CONSTEXPR `tribool` ``tribool`` ``tribool``
BOOST_CONSTEXPR `tribool` ``tribool`` `bool`
BOOST_CONSTEXPR `tribool` `bool` ``tribool``
BOOST_CONSTEXPR `tribool` `indeterminate_keyword_t` ``tribool``
BOOST_CONSTEXPR `tribool` ``tribool`` `indeterminate_keyword_t`
Computes the logical disjunction of two tribools.

the result of logically ORing the two tribool values, according to the following table:

`||` | false | true | indeterminate
false | false | true | indeterminate
true | true | true | true
indeterminate | indeterminate | true | indeterminate

Will not throw.

BOOST_CONSTEXPR `tribool` ``tribool`` ``tribool``
BOOST_CONSTEXPR `tribool` ``tribool`` `bool`
BOOST_CONSTEXPR `tribool` `bool` ``tribool``
BOOST_CONSTEXPR `tribool` `indeterminate_keyword_t` ``tribool``
BOOST_CONSTEXPR `tribool` ``tribool`` `indeterminate_keyword_t`
Compare tribools for equality.

the result of comparing two tribool values, according to the following table:

`==` | false | true | indeterminate
false | true | false | indeterminate
true | false | true | indeterminate
indeterminate | indeterminate | indeterminate | indeterminate

Will not throw.

BOOST_CONSTEXPR `tribool` ``tribool`` ``tribool``
BOOST_CONSTEXPR `tribool` ``tribool`` `bool`
BOOST_CONSTEXPR `tribool` `bool` ``tribool``
BOOST_CONSTEXPR `tribool` `indeterminate_keyword_t` ``tribool``
BOOST_CONSTEXPR `tribool` ``tribool`` `indeterminate_keyword_t`
Compare tribools for inequality.

the result of comparing two tribool values for inequality, according to the following table:

`!=` | false | true | indeterminate
false | false | true | indeterminate
true | true | false | indeterminate
indeterminate | indeterminate | indeterminate | indeterminate

Will not throw.

Declare a new name for the third state of a tribool.

Use this macro to declare a new name for the third state of a tribool. This state can have any number of new names (in addition to `indeterminate`), all of which will be equivalent. The new name will be placed in the namespace in which the macro is expanded.

Example: BOOST_TRIBOOL_THIRD_STATE(true_or_false)

tribool x(true_or_false); // potentially set x if (true_or_false(x)) { // don't know what x is }

A locale facet specifying the name of the indeterminate value of a tribool.

The facet is used to perform I/O on tribool values when `std::boolalpha` has been specified. This class template is only available if the C++ standard library implementation supports locales.

CharT
std::basic_string< CharT >
std::locale::id Uniquily identifies this facet with the locale.
string_type Returns the name for the indeterminate value.
Construct the facet with the default name.
const string_type &
Construct the facet with the given name for the indeterminate value.
std::basic_string< T > Returns a string containing the default name for the indeterminate value of a tribool with the given character type T.

This routine is used by the input and output streaming operators for tribool when there is no locale support or the stream's locale does not contain the `indeterminate_name` facet.

std::basic_string< char > Returns the character string "indeterminate".
std::basic_string< wchar_t > Returns the wide character string L"indeterminate".
std::basic_ostream< CharT, Traits > & `std::basic_ostream< CharT, Traits > &` ``tribool`` Writes the value of a tribool to a stream.

When the value of `x` is either `true` or `false`, this routine is semantically equivalent to:

     out << static_cast<bool>(x);

When `x` has an indeterminate value, it outputs either the integer value 2 (if `(out.flags() & std::ios_base::boolalpha) == 0`) or the name of the indeterminate value. The name of the indeterminate value comes from the `indeterminate_name` facet (if it is defined in the output stream's locale), or from the get_default_indeterminate_name function (if it is not defined in the locale or if the C++ standard library implementation does not support locales).

`out`

std::basic_ostream< CharT, Traits > & `std::basic_ostream< CharT, Traits > &` `unspecified` Writes the indeterminate tribool value to a stream.

This routine outputs either the integer value 2 (if `(out.flags() & std::ios_base::boolalpha) == 0`) or the name of the indeterminate value. The name of the indeterminate value comes from the `indeterminate_name` facet (if it is defined in the output stream's locale), or from the get_default_indeterminate_name function (if it is not defined in the locale or if the C++ standard library implementation does not support locales).

`out`

std::basic_istream< CharT, Traits > & `std::basic_istream< CharT, Traits > &` ``tribool` &` Reads a tribool value from a stream.

When `(out.flags() & std::ios_base::boolalpha) == 0`, this function reads a `long` value from the input stream `in` and converts that value to a tribool. If that value is 0, `x` becomes `false`; if it is 1, `x` becomes `true`; if it is 2, `becomes` `indetermine`; otherwise, the operation fails (and the fail bit is set on the input stream `in`).

When `(out.flags() & std::ios_base::boolalpha) != 0`, this function first determines the names of the false, true, and indeterminate values. The false and true names are extracted from the `std::numpunct` facet of the input stream's locale (if the C++ standard library implementation supports locales), or from the `default_false_name` and `default_true_name` functions (if there is no locale support). The indeterminate name is extracted from the appropriate ``indeterminate_name`` facet (if it is available in the input stream's locale), or from the `get_default_indeterminate_name` function (if the C++ standard library implementation does not support locales, or the ``indeterminate_name`` facet is not specified for this locale object). The input is then matched to each of these names, and the tribool `x` is assigned the value corresponding to the longest name that matched. If no name is matched or all names are empty, the operation fails (and the fail bit is set on the input stream `in`).

`in`