4 (c) 1996 Han-Wen Nienhuys
9 #define one_operator(type, function, op) \
11 operator op (type t1, type t2) {\
12 return function(t1, t2) op 0;\
15 #define gpp_minmax_operator(type, op, opp) \
17 operator op(type t1, type t2)\
19 return (t1 opp t2) ? t1 : t2;\
23 #if defined (__GNUG__) && ! defined (__STRICT_ANSI__)
24 #define gpp_minmax(type, prefix)\
25 prefix gpp_minmax_operator(type, <?, <)\
26 prefix gpp_minmax_operator(type, >?, >)
28 #define gpp_minmax(type, prefix)
31 /// handy notations for a signed comparison
33 make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
34 Please fill a & in the type argument if necessary.
36 #define template_instantiate_compare(type, function, prefix) \
37 prefix one_operator(type, function, >)\
38 prefix one_operator(type, function, >=)\
39 prefix one_operator(type, function, ==)\
40 prefix one_operator(type, function, !=)\
41 prefix one_operator(type, function, <)\
42 prefix one_operator(type, function, <=)\
43 gpp_minmax(type, prefix)\
44 prefix inline type max(type t1, type t2) { return (t1 > t2 )? t1 : t2; }\
45 prefix inline type min(type t1, type t2) { return (t1 < t2 )? t1 : t2; }\
47 prefix bool operator<(type t1, type t2) /* stupid fix to allow ; */
51 #define instantiate_compare(type, func) template_instantiate_compare(type,func, )