 Timestamp:
 Mar 11, 1998, 11:47:02 AM (26 years ago)
 Branches:
 (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
 Children:
 d636adca8e47219c329f1d05ef6a4b1712a88b48
 Parents:
 071a57d32bf2ee76f41d23ebb68750940ae505ea
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

factory/templates/ftmpl_functions.h
r071a57 rc842903 1 1 /* emacs edit mode for this file is * C++ * */ 2 /* $Id: ftmpl_functions.h,v 1. 3 19970619 13:11:16schmidt Exp $ */2 /* $Id: ftmpl_functions.h,v 1.4 19980311 10:47:02 schmidt Exp $ */ 3 3 4 4 #ifndef INCL_FUNCTIONS_H 5 5 #define INCL_FUNCTIONS_H 6 6 7 //{{{ docu 8 // 9 // ftmpl_functions.h  some useful template functions. 10 // 11 // Sooner or later you need them: functions to calculate the 12 // minimum or maximum of two values or the absolute value. Here 13 // they are. All of them are inlined, hence there is no source 14 // file corresponding to `ftmpl_functions.h'. 15 // 16 // The functions are for internal use only (i.e. to build the 17 // library), hence they should not be included from `factory.h'. 18 // However, we have to install `ftmpl_functions.h' with the other 19 // templates since the functions have to be instantiated. 20 // 21 // Used by: cf_gcd.cc, cf_map.cc, fac_ezgcd.cc, sm_sparsemod.cc, 22 // ftmpl_inst.cc 23 // 24 //}}} 25 7 26 #include <factoryconf.h> 8 27 9 template<class T> 10 inline T tmax( const T & a, const T & b ) 28 //{{{ template <class T> inline T tmax ( const T & a, const T & b ) 29 //{{{ docu 30 // 31 // tmax()  return the maximum of `a' and `b'. 32 // 33 // `T' should have an `operator >()'. 34 // 35 //}}} 36 template <class T> 37 inline T tmax ( const T & a, const T & b ) 11 38 { 12 return (a > b) ? a : b;39 return (a > b) ? a : b; 13 40 } 41 //}}} 14 42 15 template<class T> 16 inline T tmin( const T & a, const T & b ) 43 //{{{ template <class T> inline T tmin ( const T & a, const T & b ) 44 //{{{ docu 45 // 46 // tmin()  return the minimum of `a' and `b'. 47 // 48 // `T' should have an `operator <()'. 49 // 50 //}}} 51 template <class T> 52 inline T tmin ( const T & a, const T & b ) 17 53 { 18 return (a < b) ? a : b;54 return (a < b) ? a : b; 19 55 } 56 //}}} 57 58 //{{{ template <class T> inline T tabs ( const T & a ) 59 //{{{ docu 60 // 61 // tabs()  return the absolute value of `a'. 62 // 63 // `T' should have an `operator >()', an `operator ()', and a 64 // `T::T( int )' constructor. 65 // 66 //}}} 67 template <class T> 68 inline T tabs ( const T & a ) 69 { 70 return (a > T( 0 )) ? a : a; 71 } 72 //}}} 20 73 21 74 #endif /* ! INCL_FUNCTIONS_H */
Note: See TracChangeset
for help on using the changeset viewer.