X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Fcompare.hh;fp=flower%2Fcompare.hh;h=05b6e89e41d8a0e9143eed417905b11fcba2691f;hb=675bd3e6ea001c3af033b51a6e2eeab6a5809e86;hp=0000000000000000000000000000000000000000;hpb=4f4ad24a3bfeb77cfd0ecca104319607bfd28a63;p=lilypond.git diff --git a/flower/compare.hh b/flower/compare.hh new file mode 100644 index 0000000000..05b6e89e41 --- /dev/null +++ b/flower/compare.hh @@ -0,0 +1,24 @@ +#ifndef COMPARE_HH +#define COMPARE_HH + +/// handy notations for a signed comparison +#define instantiate_compare(type, function) \ +inline bool operator>(type t1, type t2) { return function(t1, t2) > 0; } \ + inline bool operator>=(type t1, type t2) { return function(t1, t2) >= 0; } \ + inline bool operator==(type t1, type t2) { return function(t1, t2) == 0; } \ + inline bool operator<=(type t1, type t2) { return function(t1, t2) <= 0; } \ + inline bool operator<(type t1, type t2) { return function(t1, t2) < 0; } \ + inline type MAX(type t1, type t2) { return (t1 > t2 )? t1 : t2; }\ + inline type MIN(type t1, type t2) { return (t1 < t2 )? t1 : t2; }\ + \ + bool operator<(type t1, type t2) /* stupid fix to allow ; */ + /** + make the operators{<,<=,==,>=,>} and the MAX and MIN of two. + Please fill a & in the type argument if necessary. + */ + + + + +#endif +