Tolerance<unsigned int> and Tolerance<unsigned long long int> added.
authoralpar
Tue, 18 Jul 2006 16:59:34 +0000
changeset 2154bbc79b698f62
parent 2153 b1fb96088350
child 2155 c712e66532d8
Tolerance<unsigned int> and Tolerance<unsigned long long int> added.
lemon/tolerance.h
     1.1 --- a/lemon/tolerance.h	Tue Jul 18 15:57:55 2006 +0000
     1.2 +++ b/lemon/tolerance.h	Tue Jul 18 16:59:34 2006 +0000
     1.3 @@ -49,6 +49,8 @@
     1.4    ///\sa Tolerance<long double>
     1.5    ///\sa Tolerance<int>
     1.6    ///\sa Tolerance<long long int>
     1.7 +  ///\sa Tolerance<unsigned int>
     1.8 +  ///\sa Tolerance<unsigned long long int>
     1.9  
    1.10    template<class T>
    1.11    class Tolerance
    1.12 @@ -271,12 +273,46 @@
    1.13      static Value zero() {return 0;}
    1.14    };
    1.15  
    1.16 +  ///Unsigned integer specialization of \ref Tolerance.
    1.17 +
    1.18 +  ///Unsigned integer specialization of \ref Tolerance.
    1.19 +  ///\sa Tolerance
    1.20 +  template<>
    1.21 +  class Tolerance<unsigned int>
    1.22 +  {
    1.23 +  public:
    1.24 +    ///\e
    1.25 +    typedef unsigned int Value;
    1.26 +
    1.27 +    ///\name Comparisons
    1.28 +    ///See \ref Tolerance for more details.
    1.29 +
    1.30 +    ///@{
    1.31 +
    1.32 +    ///Returns \c true if \c a is \e surely strictly less than \c b
    1.33 +    static bool less(Value a,Value b) { return a<b;}
    1.34 +    ///Returns \c true if \c a is \e surely different from \c b
    1.35 +    static bool different(Value a,Value b) { return a!=b; }
    1.36 +    ///Returns \c true if \c a is \e surely positive
    1.37 +    static bool positive(Value a) { return 0<a; }
    1.38 +    ///Returns \c true if \c a is \e surely negative
    1.39 +    static bool negative(Value) { return false; }
    1.40 +    ///Returns \c true if \c a is \e surely non-zero
    1.41 +    static bool nonZero(Value a) { return a!=0; };
    1.42 +
    1.43 +    ///@}
    1.44 +
    1.45 +    ///Returns zero
    1.46 +    static Value zero() {return 0;}
    1.47 +  };
    1.48 +
    1.49  #ifndef __STRICT_ANSI__
    1.50  
    1.51    ///Long long integer specialization of \ref Tolerance.
    1.52  
    1.53    ///Long long integer specialization of \ref Tolerance.
    1.54 -  ///\warning This class is not ansi compatible.
    1.55 +  ///\warning This class (more exactly, type <tt>long long</tt>)
    1.56 +  ///is not ansi compatible.
    1.57    ///\sa Tolerance
    1.58    template<>
    1.59    class Tolerance<long long int>
    1.60 @@ -307,6 +343,41 @@
    1.61      static Value zero() {return 0;}
    1.62    };
    1.63  
    1.64 +  ///Unsigned long long integer specialization of \ref Tolerance.
    1.65 +
    1.66 +  ///Unsigned long long integer specialization of \ref Tolerance.
    1.67 +  ///\warning This class (more exactly, type <tt>unsigned long long</tt>)
    1.68 +  ///is not ansi compatible.
    1.69 +  ///\sa Tolerance
    1.70 +  template<>
    1.71 +  class Tolerance<unsigned long long int>
    1.72 +  {
    1.73 +  public:
    1.74 +    ///\e
    1.75 +    typedef unsigned long long int Value;
    1.76 +
    1.77 +    ///\name Comparisons
    1.78 +    ///See \ref Tolerance for more details.
    1.79 +
    1.80 +    ///@{
    1.81 +
    1.82 +    ///Returns \c true if \c a is \e surely strictly less than \c b
    1.83 +    static bool less(Value a,Value b) { return a<b;}
    1.84 +    ///Returns \c true if \c a is \e surely different from \c b
    1.85 +    static bool different(Value a,Value b) { return a!=b; }
    1.86 +    ///Returns \c true if \c a is \e surely positive
    1.87 +    static bool positive(Value a) { return 0<a; }
    1.88 +    ///Returns \c true if \c a is \e surely negative
    1.89 +    static bool negative(Value) { return false; }
    1.90 +    ///Returns \c true if \c a is \e surely non-zero
    1.91 +    static bool nonZero(Value a) { return a!=0;};
    1.92 +
    1.93 +    ///@}
    1.94 +
    1.95 +    ///Returns zero
    1.96 +    static Value zero() {return 0;}
    1.97 +  };
    1.98 +
    1.99  #endif
   1.100  
   1.101    /// @}