2011/3/11 Thomas Jarosch <thomas.jarosch@intra2net.com>
Hello,

here's a small boost::logic::tribool riddle:

-<snip>-------------------------------------

#include <iostream>
#include <boost/logic/tribool.hpp>

int main(void)
{
   boost::logic::tribool foo(boost::logic::indeterminate);
   if (foo != true)
   {
       std::cout << "reached1\n";
   }

   if (foo == boost::logic::indeterminate)
   {
       std::cout << "reached2\n";
   }

   return 0;
}

-<snap>-------------------------------------

Try to determine the printed result without looking
at the boost::logic::tribool implementation / documentation.

Intuitive?

A coworker just shot himself in the foot...

Best regards,
Thomas Jarosch

Without looking in the docs; I havent used tribool in my life ;-)

My guess is:
1) foo is intermediate => prints reached2 (cause I expect foo != true to return intermediate)
2) foo is true => prints nothing
3) foo is false => prints reached1

Now I'll check the docs...

Regards,
Kris