]> git.donarmstrong.com Git - lilypond.git/blob - flower/compare.hh
release: 0.0.7
[lilypond.git] / flower / compare.hh
1 /*
2   flowerlib
3
4   (c) 1996 Han-Wen Nienhuys
5   */
6 #ifndef COMPARE_HH
7 #define COMPARE_HH
8
9
10 #define one_operator(type, function, op)        \
11 inline bool operator op (type t1, type t2) { return function(t1, t2) op 0; }    
12
13 /// handy notations for a signed comparison
14 #define template_instantiate_compare(type, function, prefix)                            \
15 prefix one_operator(type, function, >)\
16 prefix one_operator(type, function, >=)\
17 prefix one_operator(type, function, ==)\
18 prefix one_operator(type, function, !=)\
19 prefix one_operator(type, function, <)\
20 prefix one_operator(type, function, <=)\
21 prefix inline type MAX(type t1, type t2) {  return (t1 > t2 )? t1 : t2; }\
22 prefix inline type MIN(type t1, type t2) {  return (t1 < t2 )? t1 : t2; }\
23   \
24 prefix  bool operator<(type t1, type t2) /* stupid fix to allow ; */
25      /**
26     make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
27     Please fill a & in the type argument if necessary.    
28     */
29
30
31     
32 #define instantiate_compare(type, func) template_instantiate_compare(type,func, )
33      
34
35      
36 #endif
37