I'm exploring boost::tribool and was surprised by the following behaviour.
{
using namespace boost;
boost::tribool t(indeterminate);
assert(t==indeterminate); // This assertion fails!
}
However, if I do this, the assert passes.
assert(indeterminate(t));
No compiler warnings or errors in either case. Anyone have a good explanation of why this should be??
I think the answer is in the documentation:
the result of comparing two indeterminate values is indeterminate (not true) - we don't know what the values are, so we can't tell that they are equal;
the indeterminate function can be used to test if a tribool is in an indeterminate state.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With