tmp/tmpbqc36juc/{from.md → to.md}
RENAMED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
-
###
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class ToDuration, class Rep, class Period>
|
| 5 |
constexpr ToDuration duration_cast(const duration<Rep, Period>& d);
|
| 6 |
```
|
| 7 |
|
| 8 |
-
*
|
| 9 |
-
unless `ToDuration` is a specialization of `duration`.
|
| 10 |
|
| 11 |
*Returns:* Let `CF` be
|
| 12 |
`ratio_divide<Period, typename ToDuration::period>`, and `CR` be
|
| 13 |
-
`common_type<
|
| 14 |
|
| 15 |
- If `CF::num == 1` and `CF::den == 1`, returns
|
| 16 |
``` cpp
|
| 17 |
ToDuration(static_cast<typename ToDuration::rep>(d.count()))
|
| 18 |
```
|
|
@@ -42,34 +41,31 @@ the final step. — *end note*]
|
|
| 42 |
``` cpp
|
| 43 |
template<class ToDuration, class Rep, class Period>
|
| 44 |
constexpr ToDuration floor(const duration<Rep, Period>& d);
|
| 45 |
```
|
| 46 |
|
| 47 |
-
*
|
| 48 |
-
unless `ToDuration` is a specialization of `duration`.
|
| 49 |
|
| 50 |
*Returns:* The greatest result `t` representable in `ToDuration` for
|
| 51 |
which `t <= d`.
|
| 52 |
|
| 53 |
``` cpp
|
| 54 |
template<class ToDuration, class Rep, class Period>
|
| 55 |
constexpr ToDuration ceil(const duration<Rep, Period>& d);
|
| 56 |
```
|
| 57 |
|
| 58 |
-
*
|
| 59 |
-
unless `ToDuration` is a specialization of `duration`.
|
| 60 |
|
| 61 |
*Returns:* The least result `t` representable in `ToDuration` for which
|
| 62 |
`t >= d`.
|
| 63 |
|
| 64 |
``` cpp
|
| 65 |
template<class ToDuration, class Rep, class Period>
|
| 66 |
constexpr ToDuration round(const duration<Rep, Period>& d);
|
| 67 |
```
|
| 68 |
|
| 69 |
-
*
|
| 70 |
-
unless `ToDuration` is a specialization of `duration`, and
|
| 71 |
`treat_as_floating_point_v<typename ToDuration::rep>` is `false`.
|
| 72 |
|
| 73 |
*Returns:* The value of `ToDuration` that is closest to `d`. If there
|
| 74 |
are two closest values, then return the value `t` for which
|
| 75 |
`t % 2 == 0`.
|
|
|
|
| 1 |
+
### Conversions <a id="time.duration.cast">[[time.duration.cast]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class ToDuration, class Rep, class Period>
|
| 5 |
constexpr ToDuration duration_cast(const duration<Rep, Period>& d);
|
| 6 |
```
|
| 7 |
|
| 8 |
+
*Constraints:* `ToDuration` is a specialization of `duration`.
|
|
|
|
| 9 |
|
| 10 |
*Returns:* Let `CF` be
|
| 11 |
`ratio_divide<Period, typename ToDuration::period>`, and `CR` be
|
| 12 |
+
`common_type<typename ToDuration::rep, Rep, intmax_t>::type`.
|
| 13 |
|
| 14 |
- If `CF::num == 1` and `CF::den == 1`, returns
|
| 15 |
``` cpp
|
| 16 |
ToDuration(static_cast<typename ToDuration::rep>(d.count()))
|
| 17 |
```
|
|
|
|
| 41 |
``` cpp
|
| 42 |
template<class ToDuration, class Rep, class Period>
|
| 43 |
constexpr ToDuration floor(const duration<Rep, Period>& d);
|
| 44 |
```
|
| 45 |
|
| 46 |
+
*Constraints:* `ToDuration` is a specialization of `duration`.
|
|
|
|
| 47 |
|
| 48 |
*Returns:* The greatest result `t` representable in `ToDuration` for
|
| 49 |
which `t <= d`.
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
template<class ToDuration, class Rep, class Period>
|
| 53 |
constexpr ToDuration ceil(const duration<Rep, Period>& d);
|
| 54 |
```
|
| 55 |
|
| 56 |
+
*Constraints:* `ToDuration` is a specialization of `duration`.
|
|
|
|
| 57 |
|
| 58 |
*Returns:* The least result `t` representable in `ToDuration` for which
|
| 59 |
`t >= d`.
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
template<class ToDuration, class Rep, class Period>
|
| 63 |
constexpr ToDuration round(const duration<Rep, Period>& d);
|
| 64 |
```
|
| 65 |
|
| 66 |
+
*Constraints:* `ToDuration` is a specialization of `duration` and
|
|
|
|
| 67 |
`treat_as_floating_point_v<typename ToDuration::rep>` is `false`.
|
| 68 |
|
| 69 |
*Returns:* The value of `ToDuration` that is closest to `d`. If there
|
| 70 |
are two closest values, then return the value `t` for which
|
| 71 |
`t % 2 == 0`.
|