Index: .hgignore
===================================================================
--- .hgignore	(revision 371)
+++ .hgignore	(revision 298)
@@ -23,5 +23,4 @@
 lemon/stamp-h2
 doc/Doxyfile
-cmake/cmake.version
 .dirstamp
 .libs/*
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 372)
+++ CMakeLists.txt	(revision 360)
@@ -14,7 +14,4 @@
 INCLUDE(FindDoxygen)
 INCLUDE(FindGhostscript)
-
-INCLUDE(CheckTypeSize)
-CHECK_TYPE_SIZE("long long" LONG_LONG)
 
 ENABLE_TESTING()
Index: configure.ac
===================================================================
--- configure.ac	(revision 372)
+++ configure.ac	(revision 360)
@@ -24,10 +24,4 @@
 dnl Do compilation tests using the C++ compiler.
 AC_LANG([C++])
-
-dnl Check the existence of long long type.
-AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])
-if test x"$long_long_found" = x"yes"; then
-  AC_DEFINE([HAVE_LONG_LONG], [1], [Define to 1 if you have long long.])
-fi
 
 dnl Checks for programs.
@@ -123,6 +117,4 @@
 echo C++ compiles flags............ : $CXXFLAGS
 echo
-echo Compiler supports long long... : $long_long_found
-echo
 #echo GLPK support.................. : $lx_glpk_found
 #echo CPLEX support................. : $lx_cplex_found
Index: lemon/bits/default_map.h
===================================================================
--- lemon/bits/default_map.h	(revision 372)
+++ lemon/bits/default_map.h	(revision 318)
@@ -97,5 +97,5 @@
 
 
-#if defined HAVE_LONG_LONG
+#if defined __GNUC__ && !defined __STRICT_ANSI__
 
   // long long
Index: lemon/bits/windows.cc
===================================================================
--- lemon/bits/windows.cc	(revision 370)
+++ lemon/bits/windows.cc	(revision 368)
@@ -29,13 +29,5 @@
 #define NOMINMAX
 #endif
-#ifdef UNICODE
-#undef UNICODE
-#endif
 #include <windows.h>
-#ifdef LOCALE_INVARIANT
-#define MY_LOCALE LOCALE_INVARIANT
-#else
-#define MY_LOCALE LOCALE_NEUTRAL
-#endif
 #else
 #include <unistd.h>
@@ -96,13 +88,25 @@
       SYSTEMTIME time;
       GetSystemTime(&time);
-      char buf1[11], buf2[9], buf3[5];
-	  if (GetDateFormat(MY_LOCALE, 0, &time,
-                        ("ddd MMM dd"), buf1, 11) &&
-          GetTimeFormat(MY_LOCALE, 0, &time,
-                        ("HH':'mm':'ss"), buf2, 9) &&
-          GetDateFormat(MY_LOCALE, 0, &time,
-                        ("yyyy"), buf3, 5)) {
+#if defined(_MSC_VER) && (_MSC_VER < 1500)
+      LPWSTR buf1, buf2, buf3;
+      if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
+                        L"ddd MMM dd", buf1, 11) &&
+          GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
+                        L"HH':'mm':'ss", buf2, 9) &&
+          GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
+                        L"yyyy", buf3, 5)) {
         os << buf1 << ' ' << buf2 << ' ' << buf3;
       }
+#else
+      char buf1[11], buf2[9], buf3[5];
+      if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
+                        "ddd MMM dd", buf1, 11) &&
+          GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
+                        "HH':'mm':'ss", buf2, 9) &&
+          GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
+                        "yyyy", buf3, 5)) {
+        os << buf1 << ' ' << buf2 << ' ' << buf3;
+      }
+#endif
       else os << "unknown";
 #else
Index: mon/config.h.cmake
===================================================================
--- lemon/config.h.cmake	(revision 372)
+++ 	(revision )
@@ -1,1 +1,0 @@
-#cmakedefine HAVE_LONG_LONG 1
Index: lemon/config.h.in
===================================================================
--- lemon/config.h.in	(revision 372)
+++ lemon/config.h.in	(revision 1)
@@ -4,5 +4,2 @@
 /* Define to 1 if you have GLPK. */
 #undef HAVE_GLPK
-
-/* Define to 1 if you have long long */
-#undef HAVE_LONG_LONG
Index: lemon/lgf_reader.h
===================================================================
--- lemon/lgf_reader.h	(revision 327)
+++ lemon/lgf_reader.h	(revision 374)
@@ -391,35 +391,11 @@
   class DigraphReader;
 
-  /// \brief Return a \ref DigraphReader class
-  ///
-  /// This function just returns a \ref DigraphReader class.
-  /// \relates DigraphReader
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(Digraph& digraph,
-                                       std::istream& is = std::cin) {
-    DigraphReader<Digraph> tmp(digraph, is);
-    return tmp;
-  }
-
-  /// \brief Return a \ref DigraphReader class
-  ///
-  /// This function just returns a \ref DigraphReader class.
-  /// \relates DigraphReader
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, 
+                                       std::istream& is = std::cin);
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(Digraph& digraph,
-                                       const std::string& fn) {
-    DigraphReader<Digraph> tmp(digraph, fn);
-    return tmp;
-  }
-
-  /// \brief Return a \ref DigraphReader class
-  ///
-  /// This function just returns a \ref DigraphReader class.
-  /// \relates DigraphReader
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, const std::string& fn);
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) {
-    DigraphReader<Digraph> tmp(digraph, fn);
-    return tmp;
-  }
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char *fn);
 
   /// \ingroup lemon_io
@@ -585,10 +561,11 @@
   private:
 
-    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
-                                                  std::istream& is);
-    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
-                                                  const std::string& fn);
-    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
-                                                  const char *fn);
+    template <typename DGR>
+    friend DigraphReader<DGR> digraphReader(DGR& digraph, std::istream& is);
+    template <typename DGR>
+    friend DigraphReader<DGR> digraphReader(DGR& digraph, 
+                                            const std::string& fn);
+    template <typename DGR>
+    friend DigraphReader<DGR> digraphReader(DGR& digraph, const char *fn);
 
     DigraphReader(DigraphReader& other)
@@ -1211,36 +1188,45 @@
   };
 
+  /// \brief Return a \ref DigraphReader class
+  ///
+  /// This function just returns a \ref DigraphReader class.
+  /// \relates DigraphReader
+  template <typename Digraph>
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, std::istream& is) {
+    DigraphReader<Digraph> tmp(digraph, is);
+    return tmp;
+  }
+
+  /// \brief Return a \ref DigraphReader class
+  ///
+  /// This function just returns a \ref DigraphReader class.
+  /// \relates DigraphReader
+  template <typename Digraph>
+  DigraphReader<Digraph> digraphReader(Digraph& digraph,
+                                       const std::string& fn) {
+    DigraphReader<Digraph> tmp(digraph, fn);
+    return tmp;
+  }
+
+  /// \brief Return a \ref DigraphReader class
+  ///
+  /// This function just returns a \ref DigraphReader class.
+  /// \relates DigraphReader
+  template <typename Digraph>
+  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) {
+    DigraphReader<Digraph> tmp(digraph, fn);
+    return tmp;
+  }
+
   template <typename Graph>
   class GraphReader;
-
-  /// \brief Return a \ref GraphReader class
-  ///
-  /// This function just returns a \ref GraphReader class.
-  /// \relates GraphReader
+ 
   template <typename Graph>
-  GraphReader<Graph> graphReader(Graph& graph, std::istream& is = std::cin) {
-    GraphReader<Graph> tmp(graph, is);
-    return tmp;
-  }
-
-  /// \brief Return a \ref GraphReader class
-  ///
-  /// This function just returns a \ref GraphReader class.
-  /// \relates GraphReader
+  GraphReader<Graph> graphReader(Graph& graph, 
+                                 std::istream& is = std::cin);
   template <typename Graph>
-  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) {
-    GraphReader<Graph> tmp(graph, fn);
-    return tmp;
-  }
-
-  /// \brief Return a \ref GraphReader class
-  ///
-  /// This function just returns a \ref GraphReader class.
-  /// \relates GraphReader
+  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn);
   template <typename Graph>
-  GraphReader<Graph> graphReader(Graph& graph, const char* fn) {
-    GraphReader<Graph> tmp(graph, fn);
-    return tmp;
-  }
+  GraphReader<Graph> graphReader(Graph& graph, const char *fn);
 
   /// \ingroup lemon_io
@@ -1369,8 +1355,10 @@
 
   private:
-    friend GraphReader<Graph> graphReader<>(Graph& graph, std::istream& is);
-    friend GraphReader<Graph> graphReader<>(Graph& graph,
-                                            const std::string& fn);
-    friend GraphReader<Graph> graphReader<>(Graph& graph, const char *fn);
+    template <typename GR>
+    friend GraphReader<GR> graphReader(GR& graph, std::istream& is);
+    template <typename GR>
+    friend GraphReader<GR> graphReader(GR& graph, const std::string& fn); 
+    template <typename GR>
+    friend GraphReader<GR> graphReader(GR& graph, const char *fn);
 
     GraphReader(GraphReader& other)
@@ -2040,4 +2028,34 @@
 
   };
+
+  /// \brief Return a \ref GraphReader class
+  ///
+  /// This function just returns a \ref GraphReader class.
+  /// \relates GraphReader
+  template <typename Graph>
+  GraphReader<Graph> graphReader(Graph& graph, std::istream& is) {
+    GraphReader<Graph> tmp(graph, is);
+    return tmp;
+  }
+
+  /// \brief Return a \ref GraphReader class
+  ///
+  /// This function just returns a \ref GraphReader class.
+  /// \relates GraphReader
+  template <typename Graph>
+  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) {
+    GraphReader<Graph> tmp(graph, fn);
+    return tmp;
+  }
+
+  /// \brief Return a \ref GraphReader class
+  ///
+  /// This function just returns a \ref GraphReader class.
+  /// \relates GraphReader
+  template <typename Graph>
+  GraphReader<Graph> graphReader(Graph& graph, const char* fn) {
+    GraphReader<Graph> tmp(graph, fn);
+    return tmp;
+  }
 
   class SectionReader;
Index: lemon/lgf_writer.h
===================================================================
--- lemon/lgf_writer.h	(revision 327)
+++ lemon/lgf_writer.h	(revision 374)
@@ -351,36 +351,15 @@
   class DigraphWriter;
 
-  /// \brief Return a \ref DigraphWriter class
-  ///
-  /// This function just returns a \ref DigraphWriter class.
-  /// \relates DigraphWriter
   template <typename Digraph>
   DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       std::ostream& os = std::cout) {
-    DigraphWriter<Digraph> tmp(digraph, os);
-    return tmp;
-  }
-
-  /// \brief Return a \ref DigraphWriter class
-  ///
-  /// This function just returns a \ref DigraphWriter class.
-  /// \relates DigraphWriter
+                                       std::ostream& os = std::cout);
   template <typename Digraph>
   DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       const std::string& fn) {
-    DigraphWriter<Digraph> tmp(digraph, fn);
-    return tmp;
-  }
-
-  /// \brief Return a \ref DigraphWriter class
-  ///
-  /// This function just returns a \ref DigraphWriter class.
-  /// \relates DigraphWriter
+                                       const std::string& fn);
+
   template <typename Digraph>
   DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
-                                       const char* fn) {
-    DigraphWriter<Digraph> tmp(digraph, fn);
-    return tmp;
-  }
+                                       const char* fn);
+
 
   /// \ingroup lemon_io
@@ -527,10 +506,13 @@
   private:
 
-    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
-                                                  std::ostream& os);
-    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
-                                                  const std::string& fn);
-    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
-                                                  const char *fn);
+    template <typename DGR>
+    friend DigraphWriter<DGR> digraphWriter(const DGR& digraph, 
+                                            std::ostream& os);
+    template <typename DGR>
+    friend DigraphWriter<DGR> digraphWriter(const DGR& digraph,
+                                            const std::string& fn);
+    template <typename DGR>
+    friend DigraphWriter<DGR> digraphWriter(const DGR& digraph,
+                                            const char *fn);
 
     DigraphWriter(DigraphWriter& other)
@@ -934,37 +916,47 @@
   };
 
+  /// \brief Return a \ref DigraphWriter class
+  ///
+  /// This function just returns a \ref DigraphWriter class.
+  /// \relates DigraphWriter
+  template <typename Digraph>
+  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
+                                       std::ostream& os) {
+    DigraphWriter<Digraph> tmp(digraph, os);
+    return tmp;
+  }
+
+  /// \brief Return a \ref DigraphWriter class
+  ///
+  /// This function just returns a \ref DigraphWriter class.
+  /// \relates DigraphWriter
+  template <typename Digraph>
+  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
+                                       const std::string& fn) {
+    DigraphWriter<Digraph> tmp(digraph, fn);
+    return tmp;
+  }
+
+  /// \brief Return a \ref DigraphWriter class
+  ///
+  /// This function just returns a \ref DigraphWriter class.
+  /// \relates DigraphWriter
+  template <typename Digraph>
+  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
+                                       const char* fn) {
+    DigraphWriter<Digraph> tmp(digraph, fn);
+    return tmp;
+  }
+
   template <typename Graph>
   class GraphWriter;
 
-  /// \brief Return a \ref GraphWriter class
-  ///
-  /// This function just returns a \ref GraphWriter class.
-  /// \relates GraphWriter
   template <typename Graph>
   GraphWriter<Graph> graphWriter(const Graph& graph,
-                                 std::ostream& os = std::cout) {
-    GraphWriter<Graph> tmp(graph, os);
-    return tmp;
-  }
-
-  /// \brief Return a \ref GraphWriter class
-  ///
-  /// This function just returns a \ref GraphWriter class.
-  /// \relates GraphWriter
+                                 std::ostream& os = std::cout);
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn) {
-    GraphWriter<Graph> tmp(graph, fn);
-    return tmp;
-  }
-
-  /// \brief Return a \ref GraphWriter class
-  ///
-  /// This function just returns a \ref GraphWriter class.
-  /// \relates GraphWriter
+  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn);
   template <typename Graph>
-  GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn) {
-    GraphWriter<Graph> tmp(graph, fn);
-    return tmp;
-  }
+  GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn);
 
   /// \ingroup lemon_io
@@ -1082,11 +1074,14 @@
   private:
 
-    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
-                                            std::ostream& os);
-    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
-                                            const std::string& fn);
-    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
-                                            const char *fn);
-
+    template <typename GR>
+    friend GraphWriter<GR> graphWriter(const GR& graph,
+                                       std::ostream& os);
+    template <typename GR>
+    friend GraphWriter<GR> graphWriter(const GR& graph,
+                                       const std::string& fn);
+    template <typename GR>
+    friend GraphWriter<GR> graphWriter(const GR& graph,
+                                       const char *fn);
+    
     GraphWriter(GraphWriter& other)
       : _os(other._os), local_os(other.local_os), _graph(other._graph),
@@ -1534,4 +1529,35 @@
     /// @}
   };
+
+  /// \brief Return a \ref GraphWriter class
+  ///
+  /// This function just returns a \ref GraphWriter class.
+  /// \relates GraphWriter
+  template <typename Graph>
+  GraphWriter<Graph> graphWriter(const Graph& graph,
+                                 std::ostream& os) {
+    GraphWriter<Graph> tmp(graph, os);
+    return tmp;
+  }
+
+  /// \brief Return a \ref GraphWriter class
+  ///
+  /// This function just returns a \ref GraphWriter class.
+  /// \relates GraphWriter
+  template <typename Graph>
+  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn) {
+    GraphWriter<Graph> tmp(graph, fn);
+    return tmp;
+  }
+
+  /// \brief Return a \ref GraphWriter class
+  ///
+  /// This function just returns a \ref GraphWriter class.
+  /// \relates GraphWriter
+  template <typename Graph>
+  GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn) {
+    GraphWriter<Graph> tmp(graph, fn);
+    return tmp;
+  }
 
   class SectionWriter;
Index: lemon/path.h
===================================================================
--- lemon/path.h	(revision 317)
+++ lemon/path.h	(revision 374)
@@ -930,7 +930,6 @@
 
     template <typename Target, typename Source,
-              bool buildEnable = BuildTagIndicator<Target>::value,
-              bool revEnable = RevPathTagIndicator<Source>::value>
-    struct PathCopySelector {
+              bool buildEnable = BuildTagIndicator<Target>::value>
+    struct PathCopySelectorForward {
       static void copy(Target& target, const Source& source) {
         target.clear();
@@ -942,5 +941,14 @@
 
     template <typename Target, typename Source>
-    struct PathCopySelector<Target, Source, false, true> {
+    struct PathCopySelectorForward<Target, Source, true> {
+      static void copy(Target& target, const Source& source) {
+        target.clear();
+        target.build(source);
+      }
+    };
+
+    template <typename Target, typename Source,
+              bool buildEnable = BuildTagIndicator<Target>::value>
+    struct PathCopySelectorBackward {
       static void copy(Target& target, const Source& source) {
         target.clear();
@@ -952,17 +960,25 @@
 
     template <typename Target, typename Source>
-    struct PathCopySelector<Target, Source, true, false> {
-      static void copy(Target& target, const Source& source) {
-        target.clear();
-        target.build(source);
-      }
-    };
-
-    template <typename Target, typename Source>
-    struct PathCopySelector<Target, Source, true, true> {
+    struct PathCopySelectorBackward<Target, Source, true> {
       static void copy(Target& target, const Source& source) {
         target.clear();
         target.buildRev(source);
       }
+    };
+
+    
+    template <typename Target, typename Source,
+              bool revEnable = RevPathTagIndicator<Source>::value>
+    struct PathCopySelector {
+      static void copy(Target& target, const Source& source) {
+        PathCopySelectorForward<Target, Source>::copy(target, source);
+      }      
+    };
+
+    template <typename Target, typename Source>
+    struct PathCopySelector<Target, Source, true> {
+      static void copy(Target& target, const Source& source) {
+        PathCopySelectorBackward<Target, Source>::copy(target, source);
+      }      
     };
 
Index: lemon/random.h
===================================================================
--- lemon/random.h	(revision 368)
+++ lemon/random.h	(revision 374)
@@ -345,16 +345,6 @@
     };
 
-    template <typename Result, int exp, bool pos = (exp >= 0)>
+    template <typename Result, int exp>
     struct ShiftMultiplier {
-      static const Result multiplier() {
-        Result res = ShiftMultiplier<Result, exp / 2>::multiplier();
-        res *= res;
-        if ((exp & 1) == 1) res *= static_cast<Result>(2.0);
-        return res;
-      }
-    };
-
-    template <typename Result, int exp>
-    struct ShiftMultiplier<Result, exp, false> {
       static const Result multiplier() {
         Result res = ShiftMultiplier<Result, exp / 2>::multiplier();
@@ -366,5 +356,5 @@
 
     template <typename Result>
-    struct ShiftMultiplier<Result, 0, true> {
+    struct ShiftMultiplier<Result, 0> {
       static const Result multiplier() {
         return static_cast<Result>(1.0);
@@ -373,5 +363,5 @@
 
     template <typename Result>
-    struct ShiftMultiplier<Result, -20, true> {
+    struct ShiftMultiplier<Result, 20> {
       static const Result multiplier() {
         return static_cast<Result>(1.0/1048576.0);
@@ -380,12 +370,12 @@
 
     template <typename Result>
-    struct ShiftMultiplier<Result, -32, true> {
+    struct ShiftMultiplier<Result, 32> {
       static const Result multiplier() {
-        return static_cast<Result>(1.0/424967296.0);
+        return static_cast<Result>(1.0/4294967296.0);
       }
     };
 
     template <typename Result>
-    struct ShiftMultiplier<Result, -53, true> {
+    struct ShiftMultiplier<Result, 53> {
       static const Result multiplier() {
         return static_cast<Result>(1.0/9007199254740992.0);
@@ -394,5 +384,5 @@
 
     template <typename Result>
-    struct ShiftMultiplier<Result, -64, true> {
+    struct ShiftMultiplier<Result, 64> {
       static const Result multiplier() {
         return static_cast<Result>(1.0/18446744073709551616.0);
@@ -414,5 +404,5 @@
 
       static Result convert(RandomCore<Word>& rnd) {
-        return Shifting<Result, - shift - rest>::
+        return Shifting<Result, shift + rest>::
           shift(static_cast<Result>(rnd() >> (bits - rest)));
       }
@@ -424,5 +414,5 @@
 
       static Result convert(RandomCore<Word>& rnd) {
-        return Shifting<Result, - shift - bits>::
+        return Shifting<Result, shift + bits>::
           shift(static_cast<Result>(rnd())) +
           RealConversion<Result, Word, rest-bits, shift + bits>::
Index: lemon/tolerance.h
===================================================================
--- lemon/tolerance.h	(revision 373)
+++ lemon/tolerance.h	(revision 280)
@@ -39,7 +39,6 @@
   ///as a result of a probably inexact computation.
   ///
-  ///The general implementation is suitable only if the data type is exact,
-  ///like the integer types, otherwise a specialized version must be
-  ///implemented. These specialized classes like
+  ///This is an abstract class, it should be specialized for all
+  ///numerical data types. These specialized classes like
   ///Tolerance<double> may offer additional tuning parameters.
   ///
@@ -47,4 +46,8 @@
   ///\sa Tolerance<double>
   ///\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>
@@ -62,18 +65,18 @@
 
     ///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 static_cast<Value>(0) < a;}
-    ///Returns \c true if \c a is \e surely negative
-    static bool negative(Value a) {return a < static_cast<Value>(0);}
-    ///Returns \c true if \c a is \e surely non-zero
-    static bool nonZero(Value a) {return a != static_cast<Value>(0);}
+    static bool less(Value a,Value b) {return false;}
+    ///Returns \c true if \c a is \e surely different from \c b
+    static bool different(Value a,Value b) {return false;}
+    ///Returns \c true if \c a is \e surely positive
+    static bool positive(Value a) {return false;}
+    ///Returns \c true if \c a is \e surely negative
+    static bool negative(Value a) {return false;}
+    ///Returns \c true if \c a is \e surely non-zero
+    static bool nonZero(Value a) {return false;}
 
     ///@}
 
     ///Returns the zero value.
-    static Value zero() {return static_cast<Value>(0);}
+    static Value zero() {return T();}
 
     //   static bool finite(Value a) {}
@@ -236,4 +239,211 @@
   };
 
+  ///Integer specialization of Tolerance.
+
+  ///Integer specialization of Tolerance.
+  ///\sa Tolerance
+  template<>
+  class Tolerance<int>
+  {
+  public:
+    ///\e
+    typedef int Value;
+
+    ///\name Comparisons
+    ///See \ref lemon::Tolerance "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 a) { return 0>a; }
+    ///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;}
+  };
+
+  ///Unsigned integer specialization of Tolerance.
+
+  ///Unsigned integer specialization of Tolerance.
+  ///\sa Tolerance
+  template<>
+  class Tolerance<unsigned int>
+  {
+  public:
+    ///\e
+    typedef unsigned int Value;
+
+    ///\name Comparisons
+    ///See \ref lemon::Tolerance "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;}
+  };
+
+
+  ///Long integer specialization of Tolerance.
+
+  ///Long integer specialization of Tolerance.
+  ///\sa Tolerance
+  template<>
+  class Tolerance<long int>
+  {
+  public:
+    ///\e
+    typedef long int Value;
+
+    ///\name Comparisons
+    ///See \ref lemon::Tolerance "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 a) { return 0>a; }
+    ///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;}
+  };
+
+  ///Unsigned long integer specialization of Tolerance.
+
+  ///Unsigned long integer specialization of Tolerance.
+  ///\sa Tolerance
+  template<>
+  class Tolerance<unsigned long int>
+  {
+  public:
+    ///\e
+    typedef unsigned long int Value;
+
+    ///\name Comparisons
+    ///See \ref lemon::Tolerance "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;}
+  };
+
+#if defined __GNUC__ && !defined __STRICT_ANSI__
+
+  ///Long long integer specialization of Tolerance.
+
+  ///Long long integer specialization of Tolerance.
+  ///\warning This class (more exactly, type <tt>long long</tt>)
+  ///is not ansi compatible.
+  ///\sa Tolerance
+  template<>
+  class Tolerance<long long int>
+  {
+  public:
+    ///\e
+    typedef long long int Value;
+
+    ///\name Comparisons
+    ///See \ref lemon::Tolerance "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 a) { return 0>a; }
+    ///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;}
+  };
+
+  ///Unsigned long long integer specialization of Tolerance.
+
+  ///Unsigned long long integer specialization of 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 lemon::Tolerance "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
+
   /// @}
 
