On 6/03/2014 17:06, Quoth Peter Hackett:
I had code that did something like:
tribool triboolVar1 = indeterminate;
if ( triboolVar1 == indeterminate ) { cout << "triboolVar1 is indeterminate" << endl; } else { cout << "triboolVar1 is NOT indeterminate" << endl; }
I was expecting this to print "triboolVar1 is indeterminate". However it prints "triboolVar1 is NOT indeterminate".
http://www.boost.org/doc/libs/1_55_0/doc/html/tribool/tutorial.html#idp22516... Shows the correct way to test for an indeterminate value. I thought there was a truth-table for operator== on that page too, but apparently not. Maybe I'm thinking of a different library that had a similar class.
Shouldn't an "indeterminate" value equal another "indeterminate" value?
No, they're like database NULLs. They're never equal to anything, not even themselves. (Since, after all, two things that are unknown by definition cannot be known to equal each other.)