[Lemon-commits] [lemon_svn] alpar: r2868 - hugo/trunk/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 21:50:54 CET 2006


Author: alpar
Date: Tue Jul 18 18:59:34 2006
New Revision: 2868

Modified:
   hugo/trunk/lemon/tolerance.h

Log:
Tolerance<unsigned int> and Tolerance<unsigned long long int> added.

Modified: hugo/trunk/lemon/tolerance.h
==============================================================================
--- hugo/trunk/lemon/tolerance.h	(original)
+++ hugo/trunk/lemon/tolerance.h	Tue Jul 18 18:59:34 2006
@@ -49,6 +49,8 @@
   ///\sa Tolerance<long double>
   ///\sa Tolerance<int>
   ///\sa Tolerance<long long int>
+  ///\sa Tolerance<unsigned int>
+  ///\sa Tolerance<unsigned long long int>
 
   template<class T>
   class Tolerance
@@ -271,12 +273,46 @@
     static Value zero() {return 0;}
   };
 
+  ///Unsigned integer specialization of \ref Tolerance.
+
+  ///Unsigned integer specialization of \ref Tolerance.
+  ///\sa Tolerance
+  template<>
+  class Tolerance<unsigned int>
+  {
+  public:
+    ///\e
+    typedef unsigned int Value;
+
+    ///\name Comparisons
+    ///See \ref Tolerance for more details.
+
+    ///@{
+
+    ///Returns \c true if \c a is \e surely strictly less than \c b
+    static bool less(Value a,Value b) { return a<b;}
+    ///Returns \c true if \c a is \e surely different from \c b
+    static bool different(Value a,Value b) { return a!=b; }
+    ///Returns \c true if \c a is \e surely positive
+    static bool positive(Value a) { return 0<a; }
+    ///Returns \c true if \c a is \e surely negative
+    static bool negative(Value) { return false; }
+    ///Returns \c true if \c a is \e surely non-zero
+    static bool nonZero(Value a) { return a!=0; };
+
+    ///@}
+
+    ///Returns zero
+    static Value zero() {return 0;}
+  };
+
 #ifndef __STRICT_ANSI__
 
   ///Long long integer specialization of \ref Tolerance.
 
   ///Long long integer specialization of \ref Tolerance.
-  ///\warning This class is not ansi compatible.
+  ///\warning This class (more exactly, type <tt>long long</tt>)
+  ///is not ansi compatible.
   ///\sa Tolerance
   template<>
   class Tolerance<long long int>
@@ -307,6 +343,41 @@
     static Value zero() {return 0;}
   };
 
+  ///Unsigned long long integer specialization of \ref Tolerance.
+
+  ///Unsigned long long integer specialization of \ref Tolerance.
+  ///\warning This class (more exactly, type <tt>unsigned long long</tt>)
+  ///is not ansi compatible.
+  ///\sa Tolerance
+  template<>
+  class Tolerance<unsigned long long int>
+  {
+  public:
+    ///\e
+    typedef unsigned long long int Value;
+
+    ///\name Comparisons
+    ///See \ref Tolerance for more details.
+
+    ///@{
+
+    ///Returns \c true if \c a is \e surely strictly less than \c b
+    static bool less(Value a,Value b) { return a<b;}
+    ///Returns \c true if \c a is \e surely different from \c b
+    static bool different(Value a,Value b) { return a!=b; }
+    ///Returns \c true if \c a is \e surely positive
+    static bool positive(Value a) { return 0<a; }
+    ///Returns \c true if \c a is \e surely negative
+    static bool negative(Value) { return false; }
+    ///Returns \c true if \c a is \e surely non-zero
+    static bool nonZero(Value a) { return a!=0;};
+
+    ///@}
+
+    ///Returns zero
+    static Value zero() {return 0;}
+  };
+
 #endif
 
   /// @}



More information about the Lemon-commits mailing list