COIN-OR::LEMON - Graph Library

Changeset 2154:bbc79b698f62 in lemon-0.x for lemon/tolerance.h


Ignore:
Timestamp:
07/18/06 18:59:34 (18 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2868
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/tolerance.h

    r2073 r2154  
    5050  ///\sa Tolerance<int>
    5151  ///\sa Tolerance<long long int>
     52  ///\sa Tolerance<unsigned int>
     53  ///\sa Tolerance<unsigned long long int>
    5254
    5355  template<class T>
     
    272274  };
    273275
     276  ///Unsigned integer specialization of \ref Tolerance.
     277
     278  ///Unsigned integer specialization of \ref Tolerance.
     279  ///\sa Tolerance
     280  template<>
     281  class Tolerance<unsigned int>
     282  {
     283  public:
     284    ///\e
     285    typedef unsigned int Value;
     286
     287    ///\name Comparisons
     288    ///See \ref Tolerance for more details.
     289
     290    ///@{
     291
     292    ///Returns \c true if \c a is \e surely strictly less than \c b
     293    static bool less(Value a,Value b) { return a<b;}
     294    ///Returns \c true if \c a is \e surely different from \c b
     295    static bool different(Value a,Value b) { return a!=b; }
     296    ///Returns \c true if \c a is \e surely positive
     297    static bool positive(Value a) { return 0<a; }
     298    ///Returns \c true if \c a is \e surely negative
     299    static bool negative(Value) { return false; }
     300    ///Returns \c true if \c a is \e surely non-zero
     301    static bool nonZero(Value a) { return a!=0; };
     302
     303    ///@}
     304
     305    ///Returns zero
     306    static Value zero() {return 0;}
     307  };
     308
    274309#ifndef __STRICT_ANSI__
    275310
     
    277312
    278313  ///Long long integer specialization of \ref Tolerance.
    279   ///\warning This class is not ansi compatible.
     314  ///\warning This class (more exactly, type <tt>long long</tt>)
     315  ///is not ansi compatible.
    280316  ///\sa Tolerance
    281317  template<>
     
    308344  };
    309345
     346  ///Unsigned long long integer specialization of \ref Tolerance.
     347
     348  ///Unsigned long long integer specialization of \ref Tolerance.
     349  ///\warning This class (more exactly, type <tt>unsigned long long</tt>)
     350  ///is not ansi compatible.
     351  ///\sa Tolerance
     352  template<>
     353  class Tolerance<unsigned long long int>
     354  {
     355  public:
     356    ///\e
     357    typedef unsigned long long int Value;
     358
     359    ///\name Comparisons
     360    ///See \ref Tolerance for more details.
     361
     362    ///@{
     363
     364    ///Returns \c true if \c a is \e surely strictly less than \c b
     365    static bool less(Value a,Value b) { return a<b;}
     366    ///Returns \c true if \c a is \e surely different from \c b
     367    static bool different(Value a,Value b) { return a!=b; }
     368    ///Returns \c true if \c a is \e surely positive
     369    static bool positive(Value a) { return 0<a; }
     370    ///Returns \c true if \c a is \e surely negative
     371    static bool negative(Value) { return false; }
     372    ///Returns \c true if \c a is \e surely non-zero
     373    static bool nonZero(Value a) { return a!=0;};
     374
     375    ///@}
     376
     377    ///Returns zero
     378    static Value zero() {return 0;}
     379  };
     380
    310381#endif
    311382
Note: See TracChangeset for help on using the changeset viewer.