lemon/tolerance.h
changeset 2413 21eb3ccdc3df
parent 2391 14a343be7a5a
child 2553 bfced05fa852
     1.1 --- a/lemon/tolerance.h	Thu Mar 22 06:36:50 2007 +0000
     1.2 +++ b/lemon/tolerance.h	Thu Mar 22 15:40:50 2007 +0000
     1.3 @@ -305,6 +305,73 @@
     1.4      ///Returns zero
     1.5      static Value zero() {return 0;}
     1.6    };
     1.7 +  
     1.8 +
     1.9 +  ///Long integer specialization of \ref Tolerance.
    1.10 +
    1.11 +  ///Long integer specialization of \ref Tolerance.
    1.12 +  ///\sa Tolerance
    1.13 +  template<>
    1.14 +  class Tolerance<long int>
    1.15 +  {
    1.16 +  public:
    1.17 +    ///\e
    1.18 +    typedef long int Value;
    1.19 +
    1.20 +    ///\name Comparisons
    1.21 +    ///See \ref Tolerance for more details.
    1.22 +
    1.23 +    ///@{
    1.24 +
    1.25 +    ///Returns \c true if \c a is \e surely strictly less than \c b
    1.26 +    static bool less(Value a,Value b) { return a<b;}
    1.27 +    ///Returns \c true if \c a is \e surely different from \c b
    1.28 +    static bool different(Value a,Value b) { return a!=b; }
    1.29 +    ///Returns \c true if \c a is \e surely positive
    1.30 +    static bool positive(Value a) { return 0<a; }
    1.31 +    ///Returns \c true if \c a is \e surely negative
    1.32 +    static bool negative(Value a) { return 0>a; }
    1.33 +    ///Returns \c true if \c a is \e surely non-zero
    1.34 +    static bool nonZero(Value a) { return a!=0;};
    1.35 +
    1.36 +    ///@}
    1.37 +
    1.38 +    ///Returns zero
    1.39 +    static Value zero() {return 0;}
    1.40 +  };
    1.41 +
    1.42 +  ///Unsigned long integer specialization of \ref Tolerance.
    1.43 +
    1.44 +  ///Unsigned long integer specialization of \ref Tolerance.
    1.45 +  ///\sa Tolerance
    1.46 +  template<>
    1.47 +  class Tolerance<unsigned long int>
    1.48 +  {
    1.49 +  public:
    1.50 +    ///\e
    1.51 +    typedef unsigned long int Value;
    1.52 +
    1.53 +    ///\name Comparisons
    1.54 +    ///See \ref Tolerance for more details.
    1.55 +
    1.56 +    ///@{
    1.57 +
    1.58 +    ///Returns \c true if \c a is \e surely strictly less than \c b
    1.59 +    static bool less(Value a,Value b) { return a<b;}
    1.60 +    ///Returns \c true if \c a is \e surely different from \c b
    1.61 +    static bool different(Value a,Value b) { return a!=b; }
    1.62 +    ///Returns \c true if \c a is \e surely positive
    1.63 +    static bool positive(Value a) { return 0<a; }
    1.64 +    ///Returns \c true if \c a is \e surely negative
    1.65 +    static bool negative(Value) { return false; }
    1.66 +    ///Returns \c true if \c a is \e surely non-zero
    1.67 +    static bool nonZero(Value a) { return a!=0;};
    1.68 +
    1.69 +    ///@}
    1.70 +
    1.71 +    ///Returns zero
    1.72 +    static Value zero() {return 0;}
    1.73 +  };
    1.74  
    1.75  #if defined __GNUC__ && !defined __STRICT_ANSI__
    1.76