2 interval.hh -- part of flowerlib
4 (c) 1996 Han-Wen Nienhuys
22 T center() { return (left + right) /2;}
36 void unite(Interval_t<T> h);
39 *this and h are comparable
41 void intersect(Interval_t<T> h);
45 bool empty() const { return left > right; }
49 Interval_t(T m, T M) {
53 Interval_t<T> &operator += (T r) {
62 this represents the closed interval [left,right].
63 No invariants. T must be a totally ordered ring
68 int Interval__compare(const Interval_t<T>&,Interval_t<T> const&);
70 inclusion ordering. Crash if not comparable.
73 /****************************************************************
75 ****************************************************************/
79 template_instantiate_compare(Interval_t<T>&, Interval__compare, template<class T>);
84 intersection(Interval_t<T> a, Interval_t<T> const&b)
94 Interval_t<T> operator +(T a,Interval_t<T> i )
102 Interval_t<T> operator +(Interval_t<T> i,T a ){
106 typedef Interval_t<Real> Interval;
109 #define Interval__instantiate(T) template struct Interval_t<T>;\
110 template int Interval__compare(const Interval_t<T>&,Interval_t<T> const&)
113 #endif // INTERVAL_HH