Boost logo

Boost Users :

Subject: [Boost-users] Small logic::tribool riddle
From: Thomas Jarosch (thomas.jarosch_at_[hidden])
Date: 2011-03-11 06:53:16


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net