Boost logo

Boost Users :

From: Robert Ferguson (robert.ferguson_at_[hidden])
Date: 2005-02-16 15:50:21


Dear list,

I hope I am writing to the correct place, and that this isn't a
frequently asked question.. but I'd like to know alittle about
comparisons and the Interval library.

I am using intervals in a search algorithm to take advantage of the
natural inclusion function as proposed in a paper I'm trying to
implement. So far so good, except that I'm a little unhappy that I
have to use "try" and "catch" to detect the indeterminate case.

I'd like to use the boost::logic::tribool to identify the
semi-frequent indeterminant case. For example:

tribool cmp = interval1 < interval2;
      if (!indeterminate(cmp)) {
        if (cmp) {
          // something
        }
        else {
          // something else
        }
      else {
        // something
      }

When I do this and the indeterminate case happens, an exception
triggers and the function quits. This could be an error on my behalf,
but it seems like this the default behavior.

Its not that I can't do the try, catch, its just a matter of style.
Can I have my cake and eat it too?

Best,
Robert Ferguson


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