Boost logo

Boost Users :

From: Guillaume Melquiond (guillaume.melquiond_at_[hidden])
Date: 2005-02-16 17:13:31


Le mercredi 16 février 2005 à 15:50 -0500, Robert Ferguson a écrit :
> 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 a little about
> comparisons and the Interval library.

[...]

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

You are right in expecting such an implementation. Mapping interval
comparisons to tribool is natural enough to warrant it.

> 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.

Yes, the default behavior is to mimic the behavior of the real
comparison. And since there is no such thing as an indeterminate case in
the real comparison, an exception is thrown.

> 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?

You can. You just have to ask for another comparison operator.

Long version:
- libs/numeric/interval/examples/tribool.cpp
- libs/numeric/interval/doc/comparisons.htm

Short version:
- #include <boost/numeric/interval/compare/tribool.hpp>
- using namespace boost::numeric::interval_lib::compare::tribool;

Best regards,

Guillaume


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