LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1996--2020 Han-Wen Nienhuys | 4 Copyright (C) 1996--2020 Han-Wen Nienhuys |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 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 | 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 | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
11 LilyPond is distributed in the hope that it will be useful, | 11 LilyPond is distributed in the hope that it will be useful, |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
15 | 15 |
16 You should have received a copy of the GNU General Public License | 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/>. | 17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. |
18 */ | 18 */ |
19 | 19 |
20 #ifndef INTERVAL_HH | 20 #ifndef INTERVAL_HH |
21 #define INTERVAL_HH | 21 #define INTERVAL_HH |
22 | 22 |
23 #include <cmath> | 23 // Needed because of extension definitions for POSIX functions. |
| 24 #include "config.hh" |
24 | 25 |
25 #include "flower-proto.hh" | 26 #include "flower-proto.hh" |
26 #include "std-string.hh" | 27 #include "std-string.hh" |
27 #include "drul-array.hh" | 28 #include "drul-array.hh" |
| 29 |
| 30 #include <cmath> |
28 | 31 |
29 /* A T interval. This represents the closed interval [left,right]. | 32 /* A T interval. This represents the closed interval [left,right]. |
30 No invariants. T must be a totally ordered ring (with division, anyway ..) | 33 No invariants. T must be a totally ordered ring (with division, anyway ..) |
31 At instantiation, the function infinity () has to be defined explicitly. */ | 34 At instantiation, the function infinity () has to be defined explicitly. */ |
32 template<class T> | 35 template<class T> |
33 struct Interval_t : public Drul_array<T> | 36 struct Interval_t : public Drul_array<T> |
34 { | 37 { |
35 using Drul_array<T>::at; | 38 using Drul_array<T>::at; |
36 | 39 |
37 template <typename T2> | 40 template <typename T2> |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 { | 232 { |
230 assert (!is_empty ()); | 233 assert (!is_empty ()); |
231 return (at (LEFT) + at (RIGHT)) / T (2); | 234 return (at (LEFT) + at (RIGHT)) / T (2); |
232 } | 235 } |
233 | 236 |
234 typedef Interval_t<Real> Interval; | 237 typedef Interval_t<Real> Interval; |
235 typedef Interval_t<int> Slice; // weird name | 238 typedef Interval_t<int> Slice; // weird name |
236 | 239 |
237 | 240 |
238 #endif // INTERVAL_HH | 241 #endif // INTERVAL_HH |
LEFT | RIGHT |