tmp/tmp3a19ymda/{from.md → to.md}
RENAMED
|
@@ -1,43 +1,38 @@
|
|
| 1 |
### Comparison of `ratio`s <a id="ratio.comparison">[[ratio.comparison]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
template <class R1, class R2>
|
| 5 |
-
:
|
| 6 |
```
|
| 7 |
|
| 8 |
-
If `R1::num == R2::num` and `R1::den == R2::den`, `ratio_equal<R1, R2>`
|
| 9 |
-
shall be derived from
|
| 10 |
-
`integral_constant<bool, true>`; otherwise it shall be derived from
|
| 11 |
-
`integral_constant<bool, false>`.
|
| 12 |
-
|
| 13 |
``` cpp
|
| 14 |
-
template <class R1, class R2>
|
| 15 |
-
:
|
| 16 |
```
|
| 17 |
|
| 18 |
``` cpp
|
| 19 |
-
template <class R1, class R2>
|
| 20 |
-
:
|
| 21 |
```
|
| 22 |
|
| 23 |
-
If `R1::num
|
| 24 |
-
be derived from `
|
| 25 |
-
derived from `
|
| 26 |
-
other algorithms to compute this relationship to
|
| 27 |
-
overflow occurs, the program is ill-formed.
|
| 28 |
|
| 29 |
``` cpp
|
| 30 |
-
template <class R1, class R2>
|
| 31 |
-
:
|
| 32 |
```
|
| 33 |
|
| 34 |
``` cpp
|
| 35 |
-
template <class R1, class R2>
|
| 36 |
-
:
|
| 37 |
```
|
| 38 |
|
| 39 |
``` cpp
|
| 40 |
-
template <class R1, class R2>
|
| 41 |
-
:
|
| 42 |
```
|
| 43 |
|
|
|
|
| 1 |
### Comparison of `ratio`s <a id="ratio.comparison">[[ratio.comparison]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
+
template <class R1, class R2>
|
| 5 |
+
struct ratio_equal : bool_constant<R1::num == R2::num && R1::den == R2::den> { };
|
| 6 |
```
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
``` cpp
|
| 9 |
+
template <class R1, class R2>
|
| 10 |
+
struct ratio_not_equal : bool_constant<!ratio_equal_v<R1, R2>> { };
|
| 11 |
```
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
+
template <class R1, class R2>
|
| 15 |
+
struct ratio_less : bool_constant<see below> { };
|
| 16 |
```
|
| 17 |
|
| 18 |
+
If `R1::num` × `R2::den` is less than `R2::num` × `R1::den`,
|
| 19 |
+
`ratio_less<R1, R2>` shall be derived from `bool_constant<true>`;
|
| 20 |
+
otherwise it shall be derived from `bool_constant<false>`.
|
| 21 |
+
Implementations may use other algorithms to compute this relationship to
|
| 22 |
+
avoid overflow. If overflow occurs, the program is ill-formed.
|
| 23 |
|
| 24 |
``` cpp
|
| 25 |
+
template <class R1, class R2>
|
| 26 |
+
struct ratio_less_equal : bool_constant<!ratio_less_v<R2, R1>> { };
|
| 27 |
```
|
| 28 |
|
| 29 |
``` cpp
|
| 30 |
+
template <class R1, class R2>
|
| 31 |
+
struct ratio_greater : bool_constant<ratio_less_v<R2, R1>> { };
|
| 32 |
```
|
| 33 |
|
| 34 |
``` cpp
|
| 35 |
+
template <class R1, class R2>
|
| 36 |
+
struct ratio_greater_equal : bool_constant<!ratio_less_v<R1, R2>> { };
|
| 37 |
```
|
| 38 |
|