From Jason Turner

[ratio.comparison]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3a19ymda/{from.md → to.md} +17 -22
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> struct ratio_equal
5
- : integral_constant<bool, see below> { };
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> struct ratio_not_equal
15
- : integral_constant<bool, !ratio_equal<R1, R2>::value> { };
16
  ```
17
 
18
  ``` cpp
19
- template <class R1, class R2> struct ratio_less
20
- : integral_constant<bool, see below> { };
21
  ```
22
 
23
- If `R1::num * R2::den < R2::num * R1::den`, `ratio_less<R1, R2>` shall
24
- be derived from `integral_constant<bool, true>`; otherwise it shall be
25
- derived from `integral_constant<bool, false>`. Implementations may use
26
- other algorithms to compute this relationship to avoid overflow. If
27
- overflow occurs, the program is ill-formed.
28
 
29
  ``` cpp
30
- template <class R1, class R2> struct ratio_less_equal
31
- : integral_constant<bool, !ratio_less<R2, R1>::value> { };
32
  ```
33
 
34
  ``` cpp
35
- template <class R1, class R2> struct ratio_greater
36
- : integral_constant<bool, ratio_less<R2, R1>::value> { };
37
  ```
38
 
39
  ``` cpp
40
- template <class R1, class R2> struct ratio_greater_equal
41
- : integral_constant<bool, !ratio_less<R1, R2>::value> { };
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