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