Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / flower / include / compare.hh
blobcb4cbf3d17f816b923a9319c09c2f110903302e0
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1996--2011 Han-Wen Nienhuys
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef COMPARE_HH
20 #define COMPARE_HH
22 #define ONE_OPERATOR(type, function, op) \
23 inline bool \
24 operator op (type t1, type t2) \
25 { \
26 return function (t1, t2) op 0; \
29 /** handy notations for a signed comparison.
30 make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
31 Please fill a & in the type argument if necessary.
33 #define TEMPLATE_INSTANTIATE_COMPARE(type, function, prefix) \
34 prefix ONE_OPERATOR (type, function, >) \
35 prefix ONE_OPERATOR (type, function, >=) \
36 prefix ONE_OPERATOR (type, function, ==) \
37 prefix ONE_OPERATOR (type, function, !=) \
38 prefix ONE_OPERATOR (type, function, <) \
39 prefix ONE_OPERATOR (type, function, <=) \
40 /* namespace std { */ \
41 prefix inline type max (type t1, type t2) { return (t1 > t2) ? t1 : t2; } \
42 prefix inline type min (type t1, type t2) { return (t1 < t2) ? t1 : t2; } \
43 /* } */ \
44 /* stupid fix to allow ; */ \
45 prefix bool operator < (type t1, type t2)
47 #define INSTANTIATE_COMPARE(type, func) TEMPLATE_INSTANTIATE_COMPARE (type, func,)
49 #endif