From Jason Turner

[time.duration.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp74ddwcx_/{from.md → to.md} +5 -11
tmp/tmp74ddwcx_/{from.md → to.md} RENAMED
@@ -1,14 +1,13 @@
1
- #### `duration` constructors <a id="time.duration.cons">[[time.duration.cons]]</a>
2
 
3
  ``` cpp
4
  template<class Rep2>
5
  constexpr explicit duration(const Rep2& r);
6
  ```
7
 
8
- *Remarks:* This constructor shall not participate in overload resolution
9
- unless `Rep2` is implicitly convertible to `rep` and
10
 
11
  - `treat_as_floating_point_v<rep>` is `true` or
12
  - `treat_as_floating_point_v<Rep2>` is `false`.
13
 
14
  [*Example 1*:
@@ -18,21 +17,18 @@ duration<int, milli> d(3); // OK
18
  duration<int, milli> d(3.5); // error
19
  ```
20
 
21
  — *end example*]
22
 
23
- *Effects:* Constructs an object of type `duration`.
24
-
25
- *Postconditions:* `count() == static_cast<rep>(r)`.
26
 
27
  ``` cpp
28
  template<class Rep2, class Period2>
29
  constexpr duration(const duration<Rep2, Period2>& d);
30
  ```
31
 
32
- *Remarks:* This constructor shall not participate in overload resolution
33
- unless no overflow is induced in the conversion and
34
  `treat_as_floating_point_v<rep>` is `true` or both
35
  `ratio_divide<Period2, period>::den` is `1` and
36
  `treat_as_floating_point_v<Rep2>` is `false`.
37
 
38
  [*Note 1*: This requirement prevents implicit truncation error when
@@ -48,9 +44,7 @@ duration<int, micro> us = ms; // OK
48
  duration<int, milli> ms2 = us; // error
49
  ```
50
 
51
  — *end example*]
52
 
53
- *Effects:* Constructs an object of type `duration`, constructing `rep_`
54
- from
55
- `duration_cast<duration>(d).count()`.
56
 
 
1
+ ### Constructors <a id="time.duration.cons">[[time.duration.cons]]</a>
2
 
3
  ``` cpp
4
  template<class Rep2>
5
  constexpr explicit duration(const Rep2& r);
6
  ```
7
 
8
+ *Constraints:* `is_convertible_v<const Rep2&, rep>` is `true` and
 
9
 
10
  - `treat_as_floating_point_v<rep>` is `true` or
11
  - `treat_as_floating_point_v<Rep2>` is `false`.
12
 
13
  [*Example 1*:
 
17
  duration<int, milli> d(3.5); // error
18
  ```
19
 
20
  — *end example*]
21
 
22
+ *Ensures:* `count() == static_cast<rep>(r)`.
 
 
23
 
24
  ``` cpp
25
  template<class Rep2, class Period2>
26
  constexpr duration(const duration<Rep2, Period2>& d);
27
  ```
28
 
29
+ *Constraints:* No overflow is induced in the conversion and
 
30
  `treat_as_floating_point_v<rep>` is `true` or both
31
  `ratio_divide<Period2, period>::den` is `1` and
32
  `treat_as_floating_point_v<Rep2>` is `false`.
33
 
34
  [*Note 1*: This requirement prevents implicit truncation error when
 
44
  duration<int, milli> ms2 = us; // error
45
  ```
46
 
47
  — *end example*]
48
 
49
+ *Effects:* Initializes `rep_` with `duration_cast<duration>(d).count()`.
 
 
50