min() => tsMin() also max
This commit is contained in:
@@ -6,7 +6,7 @@ INC += resourceLib.cc
|
||||
INC += tsDLList.h
|
||||
INC += tsSLList.h
|
||||
INC += tsBTree.h
|
||||
INC += minmax.h
|
||||
INC += tsMinMax.h
|
||||
|
||||
include $(TOP)/config/RULES.Host
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
//
|
||||
// simple inline template functions to replace the min() and max()
|
||||
// macros
|
||||
//
|
||||
|
||||
//
|
||||
// ??? g++ 2.7.2 -Winline is unable to in line these tiny functions ???
|
||||
//
|
||||
|
||||
template <class T>
|
||||
inline const T &max(const T &a, const T &b)
|
||||
{
|
||||
return (a>b) ? a : b;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const T &min(const T &a, const T &b)
|
||||
{
|
||||
return (a<b) ? a : b;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "minmax.h"
|
||||
#include "tsMinMax.h"
|
||||
|
||||
main ()
|
||||
{
|
||||
|
||||
18
src/cxxTemplates/tsMinMax.h
Normal file
18
src/cxxTemplates/tsMinMax.h
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
//
|
||||
// simple type safe inline template functions to replace
|
||||
// the min() and max() macros
|
||||
//
|
||||
|
||||
template <class T>
|
||||
inline const T &tsMax(const T &a, const T &b)
|
||||
{
|
||||
return (a>b) ? a : b;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const T &tsMin(const T &a, const T &b)
|
||||
{
|
||||
return (a<b) ? a : b;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "minmax.h"
|
||||
#include "tsMinMax.h"
|
||||
|
||||
main ()
|
||||
{
|
||||
|
||||
18
src/libCom/cxxTemplates/tsMinMax.h
Normal file
18
src/libCom/cxxTemplates/tsMinMax.h
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
//
|
||||
// simple type safe inline template functions to replace
|
||||
// the min() and max() macros
|
||||
//
|
||||
|
||||
template <class T>
|
||||
inline const T &tsMax(const T &a, const T &b)
|
||||
{
|
||||
return (a>b) ? a : b;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline const T &tsMin(const T &a, const T &b)
|
||||
{
|
||||
return (a<b) ? a : b;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user