Changes in / [517:2b6d5d22bb23:495:dab9e610e37d] in lemon-main
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
.hgignore
r517 r472 23 23 lemon/stamp-h2 24 24 doc/Doxyfile 25 cmake/cmake.version26 25 .dirstamp 27 26 .libs/* -
CMakeLists.txt
r517 r481 32 32 SET(HAVE_GLPK TRUE) 33 33 ENDIF(GLPK_FOUND) 34 35 INCLUDE(CheckTypeSize)36 CHECK_TYPE_SIZE("long long" LONG_LONG)37 34 38 35 ENABLE_TESTING() -
configure.ac
r517 r481 22 22 dnl Do compilation tests using the C++ compiler. 23 23 AC_LANG([C++]) 24 25 dnl Check the existence of long long type.26 AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])27 if test x"$long_long_found" = x"yes"; then28 AC_DEFINE([HAVE_LONG_LONG], [1], [Define to 1 if you have long long.])29 fi30 24 31 25 dnl Checks for programs. … … 126 120 echo C++ compiles flags............ : $WARNINGCXXFLAGS $CXXFLAGS 127 121 echo 128 echo Compiler supports long long... : $long_long_found129 echo130 122 echo GLPK support.................. : $lx_glpk_found 131 123 echo CPLEX support................. : $lx_cplex_found -
lemon/bits/default_map.h
r517 r440 97 97 98 98 99 #if defined HAVE_LONG_LONG99 #if defined __GNUC__ && !defined __STRICT_ANSI__ 100 100 101 101 // long long -
lemon/bits/windows.cc
r493 r491 29 29 #define NOMINMAX 30 30 #endif 31 #ifdef UNICODE32 #undef UNICODE33 #endif34 31 #include <windows.h> 35 #ifdef LOCALE_INVARIANT36 #define MY_LOCALE LOCALE_INVARIANT37 #else38 #define MY_LOCALE LOCALE_NEUTRAL39 #endif40 32 #else 41 33 #include <unistd.h> … … 96 88 SYSTEMTIME time; 97 89 GetSystemTime(&time); 98 char buf1[11], buf2[9], buf3[5]; 99 if (GetDateFormat(MY_LOCALE, 0, &time, 100 ("ddd MMM dd"), buf1, 11) && 101 GetTimeFormat(MY_LOCALE, 0, &time, 102 ("HH':'mm':'ss"), buf2, 9) && 103 GetDateFormat(MY_LOCALE, 0, &time, 104 ("yyyy"), buf3, 5)) { 90 #if defined(_MSC_VER) && (_MSC_VER < 1500) 91 LPWSTR buf1, buf2, buf3; 92 if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, 93 L"ddd MMM dd", buf1, 11) && 94 GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time, 95 L"HH':'mm':'ss", buf2, 9) && 96 GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, 97 L"yyyy", buf3, 5)) { 105 98 os << buf1 << ' ' << buf2 << ' ' << buf3; 106 99 } 100 #else 101 char buf1[11], buf2[9], buf3[5]; 102 if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, 103 "ddd MMM dd", buf1, 11) && 104 GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time, 105 "HH':'mm':'ss", buf2, 9) && 106 GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, 107 "yyyy", buf3, 5)) { 108 os << buf1 << ' ' << buf2 << ' ' << buf3; 109 } 110 #endif 107 111 else os << "unknown"; 108 112 #else -
lemon/config.h.cmake
r517 r473 1 #cmakedefine HAVE_LONG_LONG 12 1 #cmakedefine HAVE_LP 1 3 2 #cmakedefine HAVE_MIP 1 -
lemon/config.h.in
r517 r459 1 /* Define to 1 if you have long long */2 #undef HAVE_LONG_LONG3 4 1 /* Define to 1 if you have any LP solver. */ 5 2 #undef HAVE_LP -
lemon/lgf_reader.h
r517 r440 391 391 class DigraphReader; 392 392 393 /// \brief Return a \ref DigraphReader class 394 /// 395 /// This function just returns a \ref DigraphReader class. 396 /// \relates DigraphReader 393 397 template <typename Digraph> 394 DigraphReader<Digraph> digraphReader(Digraph& digraph, 395 std::istream& is = std::cin); 398 DigraphReader<Digraph> digraphReader(Digraph& digraph, 399 std::istream& is = std::cin) { 400 DigraphReader<Digraph> tmp(digraph, is); 401 return tmp; 402 } 403 404 /// \brief Return a \ref DigraphReader class 405 /// 406 /// This function just returns a \ref DigraphReader class. 407 /// \relates DigraphReader 396 408 template <typename Digraph> 397 DigraphReader<Digraph> digraphReader(Digraph& digraph, const std::string& fn); 409 DigraphReader<Digraph> digraphReader(Digraph& digraph, 410 const std::string& fn) { 411 DigraphReader<Digraph> tmp(digraph, fn); 412 return tmp; 413 } 414 415 /// \brief Return a \ref DigraphReader class 416 /// 417 /// This function just returns a \ref DigraphReader class. 418 /// \relates DigraphReader 398 419 template <typename Digraph> 399 DigraphReader<Digraph> digraphReader(Digraph& digraph, const char *fn); 420 DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) { 421 DigraphReader<Digraph> tmp(digraph, fn); 422 return tmp; 423 } 400 424 401 425 /// \ingroup lemon_io … … 561 585 private: 562 586 563 template <typename DGR> 564 friend DigraphReader<DGR> digraphReader(DGR& digraph, std::istream& is); 565 template <typename DGR> 566 friend DigraphReader<DGR> digraphReader(DGR& digraph, 567 const std::string& fn); 568 template <typename DGR> 569 friend DigraphReader<DGR> digraphReader(DGR& digraph, const char *fn); 587 friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph, 588 std::istream& is); 589 friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph, 590 const std::string& fn); 591 friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph, 592 const char *fn); 570 593 571 594 DigraphReader(DigraphReader& other) … … 1190 1213 }; 1191 1214 1192 /// \brief Return a \ref DigraphReader class 1215 template <typename Graph> 1216 class GraphReader; 1217 1218 /// \brief Return a \ref GraphReader class 1193 1219 /// 1194 /// This function just returns a \ref DigraphReader class.1195 /// \relates DigraphReader1196 template <typename Digraph>1197 DigraphReader<Digraph> digraphReader(Digraph& digraph, std::istream& is) {1198 DigraphReader<Digraph> tmp(digraph, is);1220 /// This function just returns a \ref GraphReader class. 1221 /// \relates GraphReader 1222 template <typename Graph> 1223 GraphReader<Graph> graphReader(Graph& graph, std::istream& is = std::cin) { 1224 GraphReader<Graph> tmp(graph, is); 1199 1225 return tmp; 1200 1226 } 1201 1227 1202 /// \brief Return a \ref DigraphReader class1228 /// \brief Return a \ref GraphReader class 1203 1229 /// 1204 /// This function just returns a \ref DigraphReader class. 1205 /// \relates DigraphReader 1206 template <typename Digraph> 1207 DigraphReader<Digraph> digraphReader(Digraph& digraph, 1208 const std::string& fn) { 1209 DigraphReader<Digraph> tmp(digraph, fn); 1230 /// This function just returns a \ref GraphReader class. 1231 /// \relates GraphReader 1232 template <typename Graph> 1233 GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) { 1234 GraphReader<Graph> tmp(graph, fn); 1210 1235 return tmp; 1211 1236 } 1212 1237 1213 /// \brief Return a \ref DigraphReader class1238 /// \brief Return a \ref GraphReader class 1214 1239 /// 1215 /// This function just returns a \ref DigraphReader class.1216 /// \relates DigraphReader1217 template <typename Digraph>1218 DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) {1219 DigraphReader<Digraph> tmp(digraph, fn);1240 /// This function just returns a \ref GraphReader class. 1241 /// \relates GraphReader 1242 template <typename Graph> 1243 GraphReader<Graph> graphReader(Graph& graph, const char* fn) { 1244 GraphReader<Graph> tmp(graph, fn); 1220 1245 return tmp; 1221 1246 } 1222 1223 template <typename Graph>1224 class GraphReader;1225 1226 template <typename Graph>1227 GraphReader<Graph> graphReader(Graph& graph,1228 std::istream& is = std::cin);1229 template <typename Graph>1230 GraphReader<Graph> graphReader(Graph& graph, const std::string& fn);1231 template <typename Graph>1232 GraphReader<Graph> graphReader(Graph& graph, const char *fn);1233 1247 1234 1248 /// \ingroup lemon_io … … 1357 1371 1358 1372 private: 1359 template <typename GR> 1360 friend GraphReader<GR> graphReader(GR& graph, std::istream& is); 1361 template <typename GR> 1362 friend GraphReader<GR> graphReader(GR& graph, const std::string& fn); 1363 template <typename GR> 1364 friend GraphReader<GR> graphReader(GR& graph, const char *fn); 1373 friend GraphReader<Graph> graphReader<>(Graph& graph, std::istream& is); 1374 friend GraphReader<Graph> graphReader<>(Graph& graph, 1375 const std::string& fn); 1376 friend GraphReader<Graph> graphReader<>(Graph& graph, const char *fn); 1365 1377 1366 1378 GraphReader(GraphReader& other) … … 2032 2044 2033 2045 }; 2034 2035 /// \brief Return a \ref GraphReader class2036 ///2037 /// This function just returns a \ref GraphReader class.2038 /// \relates GraphReader2039 template <typename Graph>2040 GraphReader<Graph> graphReader(Graph& graph, std::istream& is) {2041 GraphReader<Graph> tmp(graph, is);2042 return tmp;2043 }2044 2045 /// \brief Return a \ref GraphReader class2046 ///2047 /// This function just returns a \ref GraphReader class.2048 /// \relates GraphReader2049 template <typename Graph>2050 GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) {2051 GraphReader<Graph> tmp(graph, fn);2052 return tmp;2053 }2054 2055 /// \brief Return a \ref GraphReader class2056 ///2057 /// This function just returns a \ref GraphReader class.2058 /// \relates GraphReader2059 template <typename Graph>2060 GraphReader<Graph> graphReader(Graph& graph, const char* fn) {2061 GraphReader<Graph> tmp(graph, fn);2062 return tmp;2063 }2064 2046 2065 2047 class SectionReader; -
lemon/lgf_writer.h
r517 r440 351 351 class DigraphWriter; 352 352 353 /// \brief Return a \ref DigraphWriter class 354 /// 355 /// This function just returns a \ref DigraphWriter class. 356 /// \relates DigraphWriter 353 357 template <typename Digraph> 354 358 DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, 355 std::ostream& os = std::cout); 359 std::ostream& os = std::cout) { 360 DigraphWriter<Digraph> tmp(digraph, os); 361 return tmp; 362 } 363 364 /// \brief Return a \ref DigraphWriter class 365 /// 366 /// This function just returns a \ref DigraphWriter class. 367 /// \relates DigraphWriter 356 368 template <typename Digraph> 357 369 DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, 358 const std::string& fn); 359 370 const std::string& fn) { 371 DigraphWriter<Digraph> tmp(digraph, fn); 372 return tmp; 373 } 374 375 /// \brief Return a \ref DigraphWriter class 376 /// 377 /// This function just returns a \ref DigraphWriter class. 378 /// \relates DigraphWriter 360 379 template <typename Digraph> 361 380 DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, 362 const char* fn); 363 381 const char* fn) { 382 DigraphWriter<Digraph> tmp(digraph, fn); 383 return tmp; 384 } 364 385 365 386 /// \ingroup lemon_io … … 506 527 private: 507 528 508 template <typename DGR> 509 friend DigraphWriter<DGR> digraphWriter(const DGR& digraph, 510 std::ostream& os); 511 template <typename DGR> 512 friend DigraphWriter<DGR> digraphWriter(const DGR& digraph, 513 const std::string& fn); 514 template <typename DGR> 515 friend DigraphWriter<DGR> digraphWriter(const DGR& digraph, 516 const char *fn); 529 friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph, 530 std::ostream& os); 531 friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph, 532 const std::string& fn); 533 friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph, 534 const char *fn); 517 535 518 536 DigraphWriter(DigraphWriter& other) … … 916 934 }; 917 935 918 /// \brief Return a \ref DigraphWriter class 919 /// 920 /// This function just returns a \ref DigraphWriter class. 921 /// \relates DigraphWriter 922 template <typename Digraph> 923 DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, 924 std::ostream& os) { 925 DigraphWriter<Digraph> tmp(digraph, os); 936 template <typename Graph> 937 class GraphWriter; 938 939 /// \brief Return a \ref GraphWriter class 940 /// 941 /// This function just returns a \ref GraphWriter class. 942 /// \relates GraphWriter 943 template <typename Graph> 944 GraphWriter<Graph> graphWriter(const Graph& graph, 945 std::ostream& os = std::cout) { 946 GraphWriter<Graph> tmp(graph, os); 926 947 return tmp; 927 948 } 928 949 929 /// \brief Return a \ref DigraphWriter class 930 /// 931 /// This function just returns a \ref DigraphWriter class. 932 /// \relates DigraphWriter 933 template <typename Digraph> 934 DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, 935 const std::string& fn) { 936 DigraphWriter<Digraph> tmp(digraph, fn); 950 /// \brief Return a \ref GraphWriter class 951 /// 952 /// This function just returns a \ref GraphWriter class. 953 /// \relates GraphWriter 954 template <typename Graph> 955 GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn) { 956 GraphWriter<Graph> tmp(graph, fn); 937 957 return tmp; 938 958 } 939 959 940 /// \brief Return a \ref DigraphWriter class 941 /// 942 /// This function just returns a \ref DigraphWriter class. 943 /// \relates DigraphWriter 944 template <typename Digraph> 945 DigraphWriter<Digraph> digraphWriter(const Digraph& digraph, 946 const char* fn) { 947 DigraphWriter<Digraph> tmp(digraph, fn); 960 /// \brief Return a \ref GraphWriter class 961 /// 962 /// This function just returns a \ref GraphWriter class. 963 /// \relates GraphWriter 964 template <typename Graph> 965 GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn) { 966 GraphWriter<Graph> tmp(graph, fn); 948 967 return tmp; 949 968 } 950 951 template <typename Graph>952 class GraphWriter;953 954 template <typename Graph>955 GraphWriter<Graph> graphWriter(const Graph& graph,956 std::ostream& os = std::cout);957 template <typename Graph>958 GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn);959 template <typename Graph>960 GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn);961 969 962 970 /// \ingroup lemon_io … … 1074 1082 private: 1075 1083 1076 template <typename GR> 1077 friend GraphWriter<GR> graphWriter(const GR& graph, 1078 std::ostream& os); 1079 template <typename GR> 1080 friend GraphWriter<GR> graphWriter(const GR& graph, 1081 const std::string& fn); 1082 template <typename GR> 1083 friend GraphWriter<GR> graphWriter(const GR& graph, 1084 const char *fn); 1085 1084 friend GraphWriter<Graph> graphWriter<>(const Graph& graph, 1085 std::ostream& os); 1086 friend GraphWriter<Graph> graphWriter<>(const Graph& graph, 1087 const std::string& fn); 1088 friend GraphWriter<Graph> graphWriter<>(const Graph& graph, 1089 const char *fn); 1090 1086 1091 GraphWriter(GraphWriter& other) 1087 1092 : _os(other._os), local_os(other.local_os), _graph(other._graph), … … 1529 1534 /// @} 1530 1535 }; 1531 1532 /// \brief Return a \ref GraphWriter class1533 ///1534 /// This function just returns a \ref GraphWriter class.1535 /// \relates GraphWriter1536 template <typename Graph>1537 GraphWriter<Graph> graphWriter(const Graph& graph,1538 std::ostream& os) {1539 GraphWriter<Graph> tmp(graph, os);1540 return tmp;1541 }1542 1543 /// \brief Return a \ref GraphWriter class1544 ///1545 /// This function just returns a \ref GraphWriter class.1546 /// \relates GraphWriter1547 template <typename Graph>1548 GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn) {1549 GraphWriter<Graph> tmp(graph, fn);1550 return tmp;1551 }1552 1553 /// \brief Return a \ref GraphWriter class1554 ///1555 /// This function just returns a \ref GraphWriter class.1556 /// \relates GraphWriter1557 template <typename Graph>1558 GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn) {1559 GraphWriter<Graph> tmp(graph, fn);1560 return tmp;1561 }1562 1536 1563 1537 class SectionWriter; -
lemon/path.h
r517 r440 930 930 931 931 template <typename Target, typename Source, 932 bool buildEnable = BuildTagIndicator<Target>::value> 933 struct PathCopySelectorForward { 932 bool buildEnable = BuildTagIndicator<Target>::value, 933 bool revEnable = RevPathTagIndicator<Source>::value> 934 struct PathCopySelector { 934 935 static void copy(Target& target, const Source& source) { 935 936 target.clear(); … … 941 942 942 943 template <typename Target, typename Source> 943 struct PathCopySelectorForward<Target, Source, true> { 944 static void copy(Target& target, const Source& source) { 945 target.clear(); 946 target.build(source); 947 } 948 }; 949 950 template <typename Target, typename Source, 951 bool buildEnable = BuildTagIndicator<Target>::value> 952 struct PathCopySelectorBackward { 944 struct PathCopySelector<Target, Source, false, true> { 953 945 static void copy(Target& target, const Source& source) { 954 946 target.clear(); … … 960 952 961 953 template <typename Target, typename Source> 962 struct PathCopySelectorBackward<Target, Source, true> { 954 struct PathCopySelector<Target, Source, true, false> { 955 static void copy(Target& target, const Source& source) { 956 target.clear(); 957 target.build(source); 958 } 959 }; 960 961 template <typename Target, typename Source> 962 struct PathCopySelector<Target, Source, true, true> { 963 963 static void copy(Target& target, const Source& source) { 964 964 target.clear(); 965 965 target.buildRev(source); 966 966 } 967 };968 969 970 template <typename Target, typename Source,971 bool revEnable = RevPathTagIndicator<Source>::value>972 struct PathCopySelector {973 static void copy(Target& target, const Source& source) {974 PathCopySelectorForward<Target, Source>::copy(target, source);975 }976 };977 978 template <typename Target, typename Source>979 struct PathCopySelector<Target, Source, true> {980 static void copy(Target& target, const Source& source) {981 PathCopySelectorBackward<Target, Source>::copy(target, source);982 }983 967 }; 984 968 -
lemon/random.h
r517 r492 345 345 }; 346 346 347 template <typename Result, int exp, bool pos = (exp >= 0)> 348 struct ShiftMultiplier { 349 static const Result multiplier() { 350 Result res = ShiftMultiplier<Result, exp / 2>::multiplier(); 351 res *= res; 352 if ((exp & 1) == 1) res *= static_cast<Result>(2.0); 353 return res; 354 } 355 }; 356 347 357 template <typename Result, int exp> 348 struct ShiftMultiplier {358 struct ShiftMultiplier<Result, exp, false> { 349 359 static const Result multiplier() { 350 360 Result res = ShiftMultiplier<Result, exp / 2>::multiplier(); … … 356 366 357 367 template <typename Result> 358 struct ShiftMultiplier<Result, 0 > {368 struct ShiftMultiplier<Result, 0, true> { 359 369 static const Result multiplier() { 360 370 return static_cast<Result>(1.0); … … 363 373 364 374 template <typename Result> 365 struct ShiftMultiplier<Result, 20> {375 struct ShiftMultiplier<Result, -20, true> { 366 376 static const Result multiplier() { 367 377 return static_cast<Result>(1.0/1048576.0); … … 370 380 371 381 template <typename Result> 372 struct ShiftMultiplier<Result, 32> {382 struct ShiftMultiplier<Result, -32, true> { 373 383 static const Result multiplier() { 374 return static_cast<Result>(1.0/42 94967296.0);384 return static_cast<Result>(1.0/424967296.0); 375 385 } 376 386 }; 377 387 378 388 template <typename Result> 379 struct ShiftMultiplier<Result, 53> {389 struct ShiftMultiplier<Result, -53, true> { 380 390 static const Result multiplier() { 381 391 return static_cast<Result>(1.0/9007199254740992.0); … … 384 394 385 395 template <typename Result> 386 struct ShiftMultiplier<Result, 64> {396 struct ShiftMultiplier<Result, -64, true> { 387 397 static const Result multiplier() { 388 398 return static_cast<Result>(1.0/18446744073709551616.0); … … 404 414 405 415 static Result convert(RandomCore<Word>& rnd) { 406 return Shifting<Result, shift +rest>::416 return Shifting<Result, - shift - rest>:: 407 417 shift(static_cast<Result>(rnd() >> (bits - rest))); 408 418 } … … 414 424 415 425 static Result convert(RandomCore<Word>& rnd) { 416 return Shifting<Result, shift +bits>::426 return Shifting<Result, - shift - bits>:: 417 427 shift(static_cast<Result>(rnd())) + 418 428 RealConversion<Result, Word, rest-bits, shift + bits>:: -
lemon/tolerance.h
r517 r440 39 39 ///as a result of a probably inexact computation. 40 40 /// 41 ///The general implementation is suitable only if the data type is exact, 42 ///like the integer types, otherwise a specialized version must be 43 ///implemented. These specialized classes like 41 ///This is an abstract class, it should be specialized for all 42 ///numerical data types. These specialized classes like 44 43 ///Tolerance<double> may offer additional tuning parameters. 45 44 /// … … 47 46 ///\sa Tolerance<double> 48 47 ///\sa Tolerance<long double> 48 ///\sa Tolerance<int> 49 ///\sa Tolerance<long long int> 50 ///\sa Tolerance<unsigned int> 51 ///\sa Tolerance<unsigned long long int> 49 52 50 53 template<class T> … … 62 65 63 66 ///Returns \c true if \c a is \e surely strictly less than \c b 64 static bool less(Value a,Value b) {return a<b;}65 ///Returns \c true if \c a is \e surely different from \c b 66 static bool different(Value a,Value b) {return a!=b;}67 ///Returns \c true if \c a is \e surely positive 68 static bool positive(Value a) {return static_cast<Value>(0) < a;}69 ///Returns \c true if \c a is \e surely negative 70 static bool negative(Value a) {return a < static_cast<Value>(0);}71 ///Returns \c true if \c a is \e surely non-zero 72 static bool nonZero(Value a) {return a != static_cast<Value>(0);}67 static bool less(Value a,Value b) {return false;} 68 ///Returns \c true if \c a is \e surely different from \c b 69 static bool different(Value a,Value b) {return false;} 70 ///Returns \c true if \c a is \e surely positive 71 static bool positive(Value a) {return false;} 72 ///Returns \c true if \c a is \e surely negative 73 static bool negative(Value a) {return false;} 74 ///Returns \c true if \c a is \e surely non-zero 75 static bool nonZero(Value a) {return false;} 73 76 74 77 ///@} 75 78 76 79 ///Returns the zero value. 77 static Value zero() {return static_cast<Value>(0);}80 static Value zero() {return T();} 78 81 79 82 // static bool finite(Value a) {} … … 236 239 }; 237 240 241 ///Integer specialization of Tolerance. 242 243 ///Integer specialization of Tolerance. 244 ///\sa Tolerance 245 template<> 246 class Tolerance<int> 247 { 248 public: 249 ///\e 250 typedef int Value; 251 252 ///\name Comparisons 253 ///See \ref lemon::Tolerance "Tolerance" for more details. 254 255 ///@{ 256 257 ///Returns \c true if \c a is \e surely strictly less than \c b 258 static bool less(Value a,Value b) { return a<b;} 259 ///Returns \c true if \c a is \e surely different from \c b 260 static bool different(Value a,Value b) { return a!=b; } 261 ///Returns \c true if \c a is \e surely positive 262 static bool positive(Value a) { return 0<a; } 263 ///Returns \c true if \c a is \e surely negative 264 static bool negative(Value a) { return 0>a; } 265 ///Returns \c true if \c a is \e surely non-zero 266 static bool nonZero(Value a) { return a!=0; } 267 268 ///@} 269 270 ///Returns zero 271 static Value zero() {return 0;} 272 }; 273 274 ///Unsigned integer specialization of Tolerance. 275 276 ///Unsigned integer specialization of Tolerance. 277 ///\sa Tolerance 278 template<> 279 class Tolerance<unsigned int> 280 { 281 public: 282 ///\e 283 typedef unsigned int Value; 284 285 ///\name Comparisons 286 ///See \ref lemon::Tolerance "Tolerance" for more details. 287 288 ///@{ 289 290 ///Returns \c true if \c a is \e surely strictly less than \c b 291 static bool less(Value a,Value b) { return a<b;} 292 ///Returns \c true if \c a is \e surely different from \c b 293 static bool different(Value a,Value b) { return a!=b; } 294 ///Returns \c true if \c a is \e surely positive 295 static bool positive(Value a) { return 0<a; } 296 ///Returns \c true if \c a is \e surely negative 297 static bool negative(Value) { return false; } 298 ///Returns \c true if \c a is \e surely non-zero 299 static bool nonZero(Value a) { return a!=0; } 300 301 ///@} 302 303 ///Returns zero 304 static Value zero() {return 0;} 305 }; 306 307 308 ///Long integer specialization of Tolerance. 309 310 ///Long integer specialization of Tolerance. 311 ///\sa Tolerance 312 template<> 313 class Tolerance<long int> 314 { 315 public: 316 ///\e 317 typedef long int Value; 318 319 ///\name Comparisons 320 ///See \ref lemon::Tolerance "Tolerance" for more details. 321 322 ///@{ 323 324 ///Returns \c true if \c a is \e surely strictly less than \c b 325 static bool less(Value a,Value b) { return a<b;} 326 ///Returns \c true if \c a is \e surely different from \c b 327 static bool different(Value a,Value b) { return a!=b; } 328 ///Returns \c true if \c a is \e surely positive 329 static bool positive(Value a) { return 0<a; } 330 ///Returns \c true if \c a is \e surely negative 331 static bool negative(Value a) { return 0>a; } 332 ///Returns \c true if \c a is \e surely non-zero 333 static bool nonZero(Value a) { return a!=0;} 334 335 ///@} 336 337 ///Returns zero 338 static Value zero() {return 0;} 339 }; 340 341 ///Unsigned long integer specialization of Tolerance. 342 343 ///Unsigned long integer specialization of Tolerance. 344 ///\sa Tolerance 345 template<> 346 class Tolerance<unsigned long int> 347 { 348 public: 349 ///\e 350 typedef unsigned long int Value; 351 352 ///\name Comparisons 353 ///See \ref lemon::Tolerance "Tolerance" for more details. 354 355 ///@{ 356 357 ///Returns \c true if \c a is \e surely strictly less than \c b 358 static bool less(Value a,Value b) { return a<b;} 359 ///Returns \c true if \c a is \e surely different from \c b 360 static bool different(Value a,Value b) { return a!=b; } 361 ///Returns \c true if \c a is \e surely positive 362 static bool positive(Value a) { return 0<a; } 363 ///Returns \c true if \c a is \e surely negative 364 static bool negative(Value) { return false; } 365 ///Returns \c true if \c a is \e surely non-zero 366 static bool nonZero(Value a) { return a!=0;} 367 368 ///@} 369 370 ///Returns zero 371 static Value zero() {return 0;} 372 }; 373 374 #if defined __GNUC__ && !defined __STRICT_ANSI__ 375 376 ///Long long integer specialization of Tolerance. 377 378 ///Long long integer specialization of Tolerance. 379 ///\warning This class (more exactly, type <tt>long long</tt>) 380 ///is not ansi compatible. 381 ///\sa Tolerance 382 template<> 383 class Tolerance<long long int> 384 { 385 public: 386 ///\e 387 typedef long long int Value; 388 389 ///\name Comparisons 390 ///See \ref lemon::Tolerance "Tolerance" for more details. 391 392 ///@{ 393 394 ///Returns \c true if \c a is \e surely strictly less than \c b 395 static bool less(Value a,Value b) { return a<b;} 396 ///Returns \c true if \c a is \e surely different from \c b 397 static bool different(Value a,Value b) { return a!=b; } 398 ///Returns \c true if \c a is \e surely positive 399 static bool positive(Value a) { return 0<a; } 400 ///Returns \c true if \c a is \e surely negative 401 static bool negative(Value a) { return 0>a; } 402 ///Returns \c true if \c a is \e surely non-zero 403 static bool nonZero(Value a) { return a!=0;} 404 405 ///@} 406 407 ///Returns zero 408 static Value zero() {return 0;} 409 }; 410 411 ///Unsigned long long integer specialization of Tolerance. 412 413 ///Unsigned long long integer specialization of Tolerance. 414 ///\warning This class (more exactly, type <tt>unsigned long long</tt>) 415 ///is not ansi compatible. 416 ///\sa Tolerance 417 template<> 418 class Tolerance<unsigned long long int> 419 { 420 public: 421 ///\e 422 typedef unsigned long long int Value; 423 424 ///\name Comparisons 425 ///See \ref lemon::Tolerance "Tolerance" for more details. 426 427 ///@{ 428 429 ///Returns \c true if \c a is \e surely strictly less than \c b 430 static bool less(Value a,Value b) { return a<b;} 431 ///Returns \c true if \c a is \e surely different from \c b 432 static bool different(Value a,Value b) { return a!=b; } 433 ///Returns \c true if \c a is \e surely positive 434 static bool positive(Value a) { return 0<a; } 435 ///Returns \c true if \c a is \e surely negative 436 static bool negative(Value) { return false; } 437 ///Returns \c true if \c a is \e surely non-zero 438 static bool nonZero(Value a) { return a!=0;} 439 440 ///@} 441 442 ///Returns zero 443 static Value zero() {return 0;} 444 }; 445 446 #endif 447 238 448 /// @} 239 449
Note: See TracChangeset
for help on using the changeset viewer.