tmp/tmp4trx52im/{from.md → to.md}
RENAMED
|
@@ -12,11 +12,11 @@ as a rational constant using the template `ratio`.
|
|
| 12 |
namespace std::chrono {
|
| 13 |
template<class Rep, class Period = ratio<1>>
|
| 14 |
class duration {
|
| 15 |
public:
|
| 16 |
using rep = Rep;
|
| 17 |
-
using period =
|
| 18 |
|
| 19 |
private:
|
| 20 |
rep rep_; // exposition only
|
| 21 |
|
| 22 |
public:
|
|
@@ -65,13 +65,14 @@ If `Period` is not a specialization of `ratio`, the program is
|
|
| 65 |
ill-formed. If `Period::num` is not positive, the program is ill-formed.
|
| 66 |
|
| 67 |
Members of `duration` do not throw exceptions other than those thrown by
|
| 68 |
the indicated operations on their representations.
|
| 69 |
|
| 70 |
-
The defaulted copy constructor of duration shall be a constexpr
|
| 71 |
-
if and only if the required initialization of the member `rep_`
|
| 72 |
-
and move, respectively, would be constexpr-suitable
|
|
|
|
| 73 |
|
| 74 |
[*Example 1*:
|
| 75 |
|
| 76 |
``` cpp
|
| 77 |
duration<long, ratio<60>> d0; // holds a count of minutes using a long
|
|
@@ -96,11 +97,11 @@ template<class Rep2>
|
|
| 96 |
|
| 97 |
[*Example 1*:
|
| 98 |
|
| 99 |
``` cpp
|
| 100 |
duration<int, milli> d(3); // OK
|
| 101 |
-
duration<int, milli>
|
| 102 |
```
|
| 103 |
|
| 104 |
— *end example*]
|
| 105 |
|
| 106 |
*Effects:* Initializes `rep_` with `r`.
|
|
|
|
| 12 |
namespace std::chrono {
|
| 13 |
template<class Rep, class Period = ratio<1>>
|
| 14 |
class duration {
|
| 15 |
public:
|
| 16 |
using rep = Rep;
|
| 17 |
+
using period = Period::type;
|
| 18 |
|
| 19 |
private:
|
| 20 |
rep rep_; // exposition only
|
| 21 |
|
| 22 |
public:
|
|
|
|
| 65 |
ill-formed. If `Period::num` is not positive, the program is ill-formed.
|
| 66 |
|
| 67 |
Members of `duration` do not throw exceptions other than those thrown by
|
| 68 |
the indicated operations on their representations.
|
| 69 |
|
| 70 |
+
The defaulted copy constructor of `duration` shall be a constexpr
|
| 71 |
+
function if and only if the required initialization of the member `rep_`
|
| 72 |
+
for copy and move, respectively, would be constexpr-suitable
|
| 73 |
+
[[dcl.constexpr]].
|
| 74 |
|
| 75 |
[*Example 1*:
|
| 76 |
|
| 77 |
``` cpp
|
| 78 |
duration<long, ratio<60>> d0; // holds a count of minutes using a long
|
|
|
|
| 97 |
|
| 98 |
[*Example 1*:
|
| 99 |
|
| 100 |
``` cpp
|
| 101 |
duration<int, milli> d(3); // OK
|
| 102 |
+
duration<int, milli> d2(3.5); // error
|
| 103 |
```
|
| 104 |
|
| 105 |
— *end example*]
|
| 106 |
|
| 107 |
*Effects:* Initializes `rep_` with `r`.
|