Skip to content

Commit 707f86a

Browse files
committed
Got rid of macros for min/max
1 parent a771fb3 commit 707f86a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

include/generic.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,18 @@
2525
#include <sstream>
2626
#include <string>
2727

28-
#define MAX(a, b) ((a > b) ? a : b)
29-
#define MIN(a, b) ((a < b) ? a : b)
28+
29+
template<typename T>
30+
T MAX(T a, T b)
31+
{
32+
return ((a > b) ? a : b);
33+
}
34+
35+
template<typename T>
36+
T MIN(T a, T b)
37+
{
38+
return ((a < b) ? a : b);
39+
}
3040

3141
namespace algo {
3242
// swap two elements

0 commit comments

Comments
 (0)