tmp/tmpy5tkogri/{from.md → to.md}
RENAMED
|
@@ -1,31 +1,33 @@
|
|
| 1 |
#### Specializations of `common_type` <a id="time.traits.specializations">[[time.traits.specializations]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template <class Rep1, class Period1, class Rep2, class Period2>
|
| 5 |
struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>> {
|
| 6 |
-
|
| 7 |
};
|
| 8 |
```
|
| 9 |
|
| 10 |
The `period` of the `duration` indicated by this specialization of
|
| 11 |
`common_type` shall be the greatest common divisor of `Period1` and
|
| 12 |
-
`Period2`.
|
|
|
|
|
|
|
| 13 |
common divisor of `Period1::num` and `Period2::num` and the least common
|
| 14 |
-
multiple of `Period1::den` and `Period2::den`.
|
| 15 |
|
| 16 |
-
The `typedef` name `type` is a synonym for the `duration`
|
| 17 |
-
largest tick `period` possible where both `duration` arguments
|
| 18 |
-
convert to it without requiring a division operation. The
|
| 19 |
-
of this type is intended to be able to hold any value
|
| 20 |
-
this conversion with no truncation error, although
|
| 21 |
-
durations may have round-off errors.
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
template <class Clock, class Duration1, class Duration2>
|
| 25 |
struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>> {
|
| 26 |
-
|
| 27 |
};
|
| 28 |
```
|
| 29 |
|
| 30 |
The common type of two `time_point` types is a `time_point` with the
|
| 31 |
same clock as the two types and the common type of their two
|
|
|
|
| 1 |
#### Specializations of `common_type` <a id="time.traits.specializations">[[time.traits.specializations]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template <class Rep1, class Period1, class Rep2, class Period2>
|
| 5 |
struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>> {
|
| 6 |
+
using type = chrono::duration<common_type_t<Rep1, Rep2>, see below>;
|
| 7 |
};
|
| 8 |
```
|
| 9 |
|
| 10 |
The `period` of the `duration` indicated by this specialization of
|
| 11 |
`common_type` shall be the greatest common divisor of `Period1` and
|
| 12 |
+
`Period2`.
|
| 13 |
+
|
| 14 |
+
[*Note 1*: This can be computed by forming a ratio of the greatest
|
| 15 |
common divisor of `Period1::num` and `Period2::num` and the least common
|
| 16 |
+
multiple of `Period1::den` and `Period2::den`. — *end note*]
|
| 17 |
|
| 18 |
+
[*Note 2*: The `typedef` name `type` is a synonym for the `duration`
|
| 19 |
+
with the largest tick `period` possible where both `duration` arguments
|
| 20 |
+
will convert to it without requiring a division operation. The
|
| 21 |
+
representation of this type is intended to be able to hold any value
|
| 22 |
+
resulting from this conversion with no truncation error, although
|
| 23 |
+
floating-point durations may have round-off errors. — *end note*]
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
template <class Clock, class Duration1, class Duration2>
|
| 27 |
struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>> {
|
| 28 |
+
using type = chrono::time_point<Clock, common_type_t<Duration1, Duration2>>;
|
| 29 |
};
|
| 30 |
```
|
| 31 |
|
| 32 |
The common type of two `time_point` types is a `time_point` with the
|
| 33 |
same clock as the two types and the common type of their two
|