Boost logo

Boost :

From: Sylvain Pion (pion_at_[hidden])
Date: 2002-09-06 16:11:32


On Fri, Sep 06, 2002 at 03:28:09PM -0400, Douglas Gregor wrote:
> > Sure, but at that point, I think it becomes confusing and bug-proning to
> > provide a default.
>
> If there isn't a default like compare_full, then interval<T> can't be used
> like a numeric type in generic code, so we'll have talked the library out of
> its intended area of usefulness!

This is wrong.

If there is no default, it ONLY means you have to choose a Comparison_policy
explicitely. interval<T> will be illformed, because there will be a necessary
second template argument, but interval<T, My_chosen_policy> will work perfectly
fine for your intended use (obviously, because you will have chosen the policy
rightly for your app) !

If the default is the one I suggest (the one with exceptions), then it
perfectly fits at least one area of usefulness. The concrete proof of that is
that CGAL's implementation has this behavior (it's even hardcoded). It calls a
bunch a template functions (the whole geometry kernel) over this interval type,
and catches exceptions and acts accordingly in this case.

I repeat again (as Herve suggested in private, we have really been loosers on
the doc to clearly state these facts) : the whole _point_ of IA is to control
roundoff errors and similar computations. So any application using intervals
must have its own management of the overlapping case, which can be different
from another.

-- 
Sylvain

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk