tmp/tmphbkchl77/{from.md → to.md}
RENAMED
|
@@ -4,15 +4,15 @@
|
|
| 4 |
template <class ToDuration, class Rep, class Period>
|
| 5 |
constexpr ToDuration duration_cast(const duration<Rep, Period>& d);
|
| 6 |
```
|
| 7 |
|
| 8 |
*Remarks:* This function shall not participate in overload resolution
|
| 9 |
-
unless `ToDuration` is
|
| 10 |
|
| 11 |
*Returns:* Let `CF` be
|
| 12 |
`ratio_divide<Period, typename ToDuration::period>`, and `CR` be
|
| 13 |
-
`common_type<` `typename ToDuration::rep, Rep, intmax_t>::type
|
| 14 |
|
| 15 |
- If `CF::num == 1` and `CF::den == 1`, returns
|
| 16 |
``` cpp
|
| 17 |
ToDuration(static_cast<typename ToDuration::rep>(d.count()))
|
| 18 |
```
|
|
@@ -30,12 +30,47 @@ unless `ToDuration` is an instantiation of `duration`.
|
|
| 30 |
``` cpp
|
| 31 |
ToDuration(static_cast<typename ToDuration::rep>(
|
| 32 |
static_cast<CR>(d.count()) * static_cast<CR>(CF::num) / static_cast<CR>(CF::den)))
|
| 33 |
```
|
| 34 |
|
| 35 |
-
*
|
| 36 |
conversions are done with `static_cast`. It avoids multiplications and
|
| 37 |
divisions when it is known at compile time that one or more arguments
|
| 38 |
is 1. Intermediate computations are carried out in the widest
|
| 39 |
representation and only converted to the destination representation at
|
| 40 |
-
the final step.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
|
|
|
| 4 |
template <class ToDuration, class Rep, class Period>
|
| 5 |
constexpr ToDuration duration_cast(const duration<Rep, Period>& d);
|
| 6 |
```
|
| 7 |
|
| 8 |
*Remarks:* This function shall not participate in overload resolution
|
| 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<` `typename ToDuration::rep, Rep, intmax_t>::type`.
|
| 14 |
|
| 15 |
- If `CF::num == 1` and `CF::den == 1`, returns
|
| 16 |
``` cpp
|
| 17 |
ToDuration(static_cast<typename ToDuration::rep>(d.count()))
|
| 18 |
```
|
|
|
|
| 30 |
``` cpp
|
| 31 |
ToDuration(static_cast<typename ToDuration::rep>(
|
| 32 |
static_cast<CR>(d.count()) * static_cast<CR>(CF::num) / static_cast<CR>(CF::den)))
|
| 33 |
```
|
| 34 |
|
| 35 |
+
[*Note 1*: This function does not use any implicit conversions; all
|
| 36 |
conversions are done with `static_cast`. It avoids multiplications and
|
| 37 |
divisions when it is known at compile time that one or more arguments
|
| 38 |
is 1. Intermediate computations are carried out in the widest
|
| 39 |
representation and only converted to the destination representation at
|
| 40 |
+
the final step. — *end note*]
|
| 41 |
+
|
| 42 |
+
``` cpp
|
| 43 |
+
template <class ToDuration, class Rep, class Period>
|
| 44 |
+
constexpr ToDuration floor(const duration<Rep, Period>& d);
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
*Remarks:* This function shall not participate in overload resolution
|
| 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 |
+
*Remarks:* This function shall not participate in overload resolution
|
| 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 |
+
*Remarks:* This function shall not participate in overload resolution
|
| 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`.
|
| 76 |
|